如何在C#中创建整数序列? [英] How to create a sequence of integers in C#?
本文介绍了如何在C#中创建整数序列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
F#具有允许创建序列的序列:
F# has sequences that allows to create sequences:
seq { 0 .. 10 }
创建从0到10的数字序列。
Create sequence of numbers from 0 to 10.
C#中是否有类似的东西?
Is there something similar in C#?
推荐答案
您可以使用 Enumerable.Range(0, 10);
。示例:
var seq = Enumerable.Range(0, 10);
MSDN页面此处。
这篇关于如何在C#中创建整数序列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文