Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# type name instead of CLR type name

Tags:

c#

system.type

typeof(int).Name

Will return System.Int32 does anyone know of a way to return "int"

like image 215
bleevo Avatar asked Dec 09 '22 22:12

bleevo


2 Answers

There aren't many types that are C# keywords (int, double, string) ... so perhaps you can write your own mapping function, from the System type name to the corresonding C# keyword.

like image 114
ChrisW Avatar answered Jan 03 '23 16:01

ChrisW


Yeah, you could write a mapping function. That is just an alias anyway.

Here is a list:

http://msdn.microsoft.com/en-us/library/86792hfa(VS.71).aspx

like image 29
BobbyShaftoe Avatar answered Jan 03 '23 16:01

BobbyShaftoe