开发者

primitive types enum - does it exist

开发者 https://www.devze.com 2022-12-12 19:39 出处:网络
I need to provide a user a list of all primitive types available and was wondering if there is an Enu开发者_运维技巧m in the .net library that has all primitive types, so that I don\'t have to build o

I need to provide a user a list of all primitive types available and was wondering if there is an Enu开发者_运维技巧m in the .net library that has all primitive types, so that I don't have to build one.


Not an enum, but:

var primitives = typeof(int).Assembly.GetTypes()
       .Where(type => type.IsPrimitive).ToArray();


The nearest you are going to get is System.TypeCode.


No, there is no such enum.

0

精彩评论

暂无评论...
验证码 换一张
取 消