Having this class :
class ClassA{
}
and a method with this signature:
void MyMethod<T>();
All we use it on this way:
MyMethod<ClassA>();
But... exist some chance of call MyMethod
having the class name as string?. I.e.:
var className = "ClassA";
MagicMethod($"MyMethod<{className}>();");
Im talking about some equivalent of Eval
in JavaScript. Reflection?, Any idea?
I googled some libraries like DynamicExpresso but nothing with support for generic types.
About possible duplicates:
- Calling a function from a string in C# not solve my problem, my question is specific to call methods with generics types.
Aucun commentaire:
Enregistrer un commentaire