On 28.02.2011 23:30, Sean Hubbell wrote:
> Given the following example, could someone confirm if this is an issue or
> just my misunderstanding of the methods?
>
> The below is Mono 2.8.2 Cross Compiled for an ARM processor. The issue comes
> up when I would like to do a couple of things with generics:
>
>     public static bool AreEqual<T>(IEnumerable<T>  one, IEnumerable<T>  two)
>          {
>              bool isEquatable =
> typeof(IEquatable<T>).IsAssignableFrom(typeof(T)); // Works: true if generic
> supports the IEquatable<T>  interface.
>
>
>              bool isEquatable = type.IsInstanceOfType(typeof(IEquatable<T>));
> // Does not work: will always return false.

I don't know what "type" is in your code, but IsInstanceOfType
will never return true if the type is a generic definition:

typeof(IEquatable<X>).IsInstanceOfType(IEquatable<T>) == false
for each concrete type X.


Robert


_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to