lundi 21 août 2017

C# - Get Type by string without specifiying full namespace

Currently, when using Assembly.GetType(string typeName) I have to specify the full namespace name, so if I had a class called MyClass within a namespace - MyNamespace.CoolClasses, to use the Assembly.GetType method I would have to specify the full namespace before the class as follows: "MyNamespace.CoolClasses.MyClass".
I would like to know if there is an existing method similar to the one I mentioned where I don't need to specifiy the full namespace name. So, if we go back to my example, all I'd need to write to get the type is Assembly.GetType("MyClass")





Aucun commentaire:

Enregistrer un commentaire