Is there an easy way to get Type object from C# type name
I want to create Type object from string value, e.g., "int", "long". I know I can create Type object from .net fr开发者_如何转开发amework type name, like Type t = Type.GetType("System.Int32").
Is there a built-in way to do same from C# type, "int", "long".
The .Net framework itself (including the Reflection library) is completely unaware of C#'s type keywords.
Therefore, you'll need to do this youself.
You can create a Dictionary<string, Type>
.
Check out Reflection.
Given I didn't understand your question here is a link to this question asked previously
typeof(int), typeof(string);
精彩评论