I'm trying to invoke a method from a dynamically loaded assembly. The method is ambiguous.
For example: The dll contains the following methods:
public static string ReadString(string key, KeyType type)
public static string ReadString(string key, string type)
I would like to invoke the one with the enum parameter KeyType.
var assembly = Assembly.LoadFile(@"stringutils.dll");
Type type = assembly.GetType("Utils.StringReader");
I tried
var method = type.GetMethod("ReadString", new[] { typeof(string) });
And tried
var method = type.GetMethod("ReadString", new[] { typeof(string), typeof(int) });
But it returns null
Aucun commentaire:
Enregistrer un commentaire