Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Get private fields per Reflection.

$
0
0

Hello,

I need a way to set a private field via reflection, like this myObject.GetType().GetField("myPrivateField").SetValue(myObject, ... ); But it doesn't work. I've testet it in a few ways, like GetTypeInfo().DeclaredFields or GetRuntimeField().. But nothing works for me, I've also testet it with a public variable but it also doesn't work.

In the Xamarin Documentation there is an information about a ReflectionPermission, but I don't know how to use it.

If anyone could help, Thank you.

Ronny


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>