I’m developing a TypeTranslator class which has a method Type TranslateType(Type type).
This method gets a type of an interface and if there’s a class of interface name without leading I it creates it, otherwise an exception is raised.
Here’s some code to clearify what’s written before:
class Program { interface IAnimal { } class Animal : IAnimal { }void Function() { TypeTranslator typeTranslator = new TypeTranslator(); Assert(typeTranslator.TranslateType(typeof(IAnimal) == typeof(Animal))); }}
Is it possible to get what I want?
Thank you for your help!
Look at
Type.GetType. The documentation can be found here.