iam trying to test if a property of my object is a collection or not but encounter problem since in portable class library many method are not avaible
this is my method:
public virtual bool Equals(TObject other) // where TObject : class
{
if (other == null)
return false;
Type t = GetType();
Type otherType = other.GetType();
TypeInfo typeInfo = t.GetTypeInfo();
if (t != otherType)
return false;
IEnumerable<FieldInfo> fields = typeInfo.DeclaredFields;
foreach (FieldInfo field in fields)
{ ...
now i have to test if field is an Icollection or not but
- ImplementedInterfaces is not avaible
- IsAssignableFrom is not avaible
- GetInterfaces() is not avaible
- GetGenericTypeDefinition() is not avaible
maybe this is because i have FieldInfo and not TypeInfo?
is there something i can do?
Aucun commentaire:
Enregistrer un commentaire