Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以我创建了一个包含 100 个变量的数组,使用Enumerable.Range. 数据类型限于Int32.
Enumerable.Range
Int32
如何创建相同的数组SByte?
SByte
我是否认为我需要使用循环来创建和索引变量?
我在网上环顾四周,大多数结果都涉及为循环声明计数变量,但没有使用循环声明变量
只需投射它们:
SByte[] array = Enumerable.Range(0, 100).Select(i => (SByte) i).ToArray();
请注意,SByte它不符合 cls,您可能希望使用它short。
short