sarah berderian
sarah berderian

Reputation: 15

Reflection to get public instance properties in UWP

I am porting a Silverlight application to UWP. In my Silverlight app, i get the public instance properties:

Type t;
t.GetProperties(BindingFlags.Instance | BindingFlags.Public);

In UWP it look like the GetProperties(BindingFlags.Instance | BindingFlags.Public) method is no longer available. Is there another way to accomplish this in UWP?

thank you.

Upvotes: 0

Views: 946

Answers (1)

Zein Makki
Zein Makki

Reputation: 30042

From this MSDN source, you can do the following:

var props = t.GetTypeInfo().DeclaredProperties
                           .Where(x => x.GetMethod.IsPublic);

Upvotes: 1

Related Questions