如何迭代 C# 中的内置类型?

2024-01-09

我想迭代 C# 中的内置类型(bool、char、sbyte、byte、short、ushort 等)。

怎么做?

foreach(var x in GetBuiltInTypes())
{
//do something on x
}

系统类型代码 http://msdn.microsoft.com/en-gb/library/system.typecode.aspx这是我能想到的最接近的事情。

foreach(TypeCode t in Enum.GetValues(typeof(TypeCode)))
{ 
    // do something interesting with the value...
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何迭代 C# 中的内置类型? 的相关文章

随机推荐