以下代码,返回List,list内容为大于60的项
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
IEnumerable<int> arry = A();
List<int> list = arry.ToList();
}
private IEnumerable<int> A() {
int[] scores = new int[] { 55, 56, 57, 58, 59, 69, 70, 33 };
foreach (var item in scores)
{
if (item > 60)
{
yield return item;
}
}
}