Calling code
typeof(int).Name I get "Int32"
How do I get short type names? That is, instead of Int32 - int, Int64 - long and so on. Manual mapping does not offer, I myself can. Just thought, maybe there is a more beautiful solution.
Calling code
typeof(int).Name I get "Int32"
How do I get short type names? That is, instead of Int32 - int, Int64 - long and so on. Manual mapping does not offer, I myself can. Just thought, maybe there is a more beautiful solution.
You can use Microsoft.CSharp.CSharpCodeProvider.GetTypeOutput
var compiler = new CSharpCodeProvider(); var type = new CodeTypeReference(typeof(int)); Console.WriteLine(typeof(int).Name); Console.WriteLine(compiler.GetTypeOutput(type)); Output:
Int32 int Source: https://ru.stackoverflow.com/questions/589242/
All Articles