I've just started out with C# reflection, and I ran into the issue of calling methods that take internal classes as arguments:
Sample class:
public class MyClass
{
public class CustomColor
{
public int h;
public int s;
public int v;
}
public string[] ConvertColors(List<CustomColor> colors)
{
//...
}
}
The code I'm using to call other methods in this class :
FieldInfo info = cInstanceContainerObject.GetType().GetField("_myClass", BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Instance);
dynamic myClassObject = info.GetValue(cInstanceContainerObject);
Allowing me to do this :
myClassObject.SomeSampleMethod(int sampleParam);
However, I'm stuck on figuring out how to create the proper parameters for the ConvertColors method above. :(
Aucun commentaire:
Enregistrer un commentaire