jeudi 13 août 2015

PCL Reflection get properties with BindingFlags

I have the code below.

    public static IEnumerable<PropertyInfo> GetAllPublicInstanceDeclaredOnlyProperties(this Type type)
    {
        var result =
            from PropertyInfo pi in type.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)
            select pi;

        return result;
    }

I am trying to convert this to a PCL library but I can not figure it out. I have tried

type.GetTypeInfo().DeclaredProperties.Where(x => x.BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)

But BindingFlags doesn't exist.

What am I missing?





Aucun commentaire:

Enregistrer un commentaire