jeudi 6 août 2015

How to determine if class inherits Dictionary<,>

I have

public class SerializableDictionary<TKey, TValue>
    : Dictionary<TKey, TValue>, IXmlSerializable

And I want to check if an object is SerializeableDictionary (of any generic types).

For that I tried:

type == typeof(SerializableDictionary<,>)
or type.isSubclass()
or typeof(SerializableDictionary<,>).isAssigneableFrom(type)

nothing works. How can I tell if the type is SerializableDictionary or any type?

tnx!





Aucun commentaire:

Enregistrer un commentaire