I have the next question, it's tricky but I can't find a way around it.
I'm creating an instance of an object using reflection and getting the methods within the class of the object, but then the problem comes when I have to use an array of type "Type" to avoid ambiguity problems, here is an example of the code that I'm trying to reach.
public class BigClass
{
public void getSomething(XmlDocument doc, ref CustomObject obj) {...}
public void getSomething(XmlDocument doc, ref CustomObject obj, string id) {...}
}
This code comes from an external assembly (file.dll), and I'm using the next code.
Assembly a = Assembly.LoadFrom("file.dll");
Type s = a.GetType("FileNamespace.BigClass");
MethodInfo inf = s.GetMethod("getSomething", new [] {typeof(XmlDocument), typeof(CustomObject), typeof(string)});
To get the MethodInfo of the object that uses 3 arguments, but the variable "inf" comes null, I think because it doesn't find the method for the argument that uses "ref".
Is there a way to solve this?
Thanks in Advance
Aucun commentaire:
Enregistrer un commentaire