none
[UWP][C#]Reflection to get public instance properties RRS feed

  • Question

  • Hello,

    I am working on porting a Silverlight application to UWP.  In my Silverlight app, I would make use of Reflection to get the public instance properties:

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

    Note that I did try to include the System.Reflection.TypeExtensions NuGet package into my app, but the app crashed with an exception that it was unable to load that dll, so I had to remove it from my project.

    Friday, June 5, 2015 8:43 PM

All replies

  • This should be supported in UWP per the documentation:

    https://msdn.microsoft.com/en-us/library/windows/apps/kyaxdd3x(v=vs.110).aspx


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, June 9, 2015 7:12 PM
    Moderator
  • No, Type.GetProperties() is not available for me.  Not sure if you have an internal build that supports it, but in my Windows Universal DLL (using VS 2015 RC build), I cannot call that method.  Just Type.GetRuntimeProperties() that has no parameters.
    Wednesday, June 10, 2015 12:47 PM