In C#, the reflected Type
object for int
contains Int32
for a Name
. Similarly, typeof(byte).Name
would be "Byte", etc. Short of introducing an explicit check for all known primitive types, is there a way to retrieve a friendly name (e. g. int
) from the said Type
object?
Asked
Active
Viewed 64 times
0

Seva Alekseyev
- 59,826
- 25
- 160
- 281
-
1This may help you. https://stackoverflow.com/questions/16466380/get-user-friendly-name-for-generic-type-in-c-sharp/34001032 – Venkata N Bhupathi Nov 18 '21 at 01:07
-
1Effectively, "yes, but it's not worth it". :) – Seva Alekseyev Nov 18 '21 at 01:15
-
https://stackoverflow.com/questions/1362884/is-there-a-way-to-get-a-types-alias-through-reflection – TheGeneral Nov 18 '21 at 02:37