Can I do this in C#:
string str="string";
Type typ=typeof(str);
Can any one help me to create generic type converter without do multiple conditions
Can I do this in C#:
string str="string";
Type typ=typeof(str);
Can any one help me to create generic type converter without do multiple conditions
The closest you will be able to get is by using Type.GetType(System.String)
.
This requires using the assembly qualified name, unless the type is defined in mscorlib, where you will be able to use just the namespace qualified name.
e.g for a class from mscorlib:
Type stringType = Type.GetType("System.String");
or for a class not from mscorlib:
Type dependencyPropertyType = Type.GetType("System.Windows.DependencyProperty, WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");