Possible Duplicate:
How can I get the primitive name of a type in C#?
I have the following code in C#:
Assembly sysAssembly = 0.GetType().Assembly;
Type[] sysTypes = sysAssembly.GetTypes();
foreach (Type sysType in sysTypes)
{
if (sysType.IsPrimitive && sysType.IsPublic)
Console.WriteLine(sysType.Name);
}
This code outputs:
Boolean, Byte, Char, Double, Int16, Int32, Int64, IntPtr, SByte, Single, UInt16, UInt32, UInt64, UIntPtr,
I would like to replace Boolean
by bool
, Byte
by byte
and so on when possible, without relying on a fixed array or dictionary. Is there a way to do this?