dimanche 8 février 2015

C#: Use classes static method when you only have the type name of the class as a string

I am wondering if it is possible to use a classes method when you only know the classes name by it's string value.


Let's say I have a class and within class I have a static method like



public class SomeClass
{
public static string Do()
{
//Do stuff
}
}


And when using class I want to something like



string str = (GetType(SomeClass)).Do();


When using the method I want to give the name of the class as string like I want to give SomeClass as a string.


Thank in advance, you all have a good day.






Aucun commentaire:

Enregistrer un commentaire