Search code examples
silverlightsilverlight-4.0silverlight-3.0silverlight-5.0silverlight-2.0

Silverlight and Non-Public members


Is it possible somehow to access non-public properties in Silverlight? Maybe using reflection?

I've tried following steps:

  1. Get class type
  2. Get property info by prop name
  3. prop.GetValue(obj, null)

It says: MethodAccessException... A there any ways to workaround/(go another way) ?


Solution

  • Officially, you will need to run the browser in elevated permissions in order to access private/protected members. With normal privileges reflection will only get you access to the members in the same assembly.

    http://msdn.microsoft.com/en-us/library/stfy7tfc(v=vs.95).aspx