How do I ensure linking works for reflection on anonymous types that are included in a code library? The library is pure C# so I can use it with Android and iOS but it uses reflection extensively. This works fine in the debugger but I realize now that it is not linking properly because there is no data in the reflected objects.
I can't use [Android.Runtime.Preserve(AllMembers=true)]
on the class because the code library does not use the Android SDK. Is there any way to get this work?
Here's an example of what I am doing that works in the debugger:
private NameValueCollection createParams(object postData)
{
NameValueCollection postParams = new NameValueCollection();
postData.GetType().GetProperties().ToList()
.ForEach(i => postParams.Add(i.Name, i.GetValue(postData, null).ToString()));
return postParams;
}
Thanks!