好记性不如烂笔头
private void button4_Click(object sender, EventArgs e)
{
// Data source.
int[] scores = { 90, 71, 82, 93, 75, 82 };
// Query Expression.
IEnumerable<int> scoreQuery = //query variable
from score in scores //required
where score > 80 // optional
orderby score descending // optional
select score; //must end with select or group
// Execute the query to produce the results
foreach (int testScore in scoreQuery)
{
textBox1.AppendText(string.Format("\r\n{0} ", testScore));
//Console.WriteLine(testScore);
}
textBox1.AppendText(string.Format("{0}\r\n ", ""));
IEnumerable<int> ss = from score in scores where score < 80 orderby score select score;
foreach (int testScore in ss)
{
textBox1.AppendText(string.Format("{0}\r\n ", testScore));
//Console.WriteLine(testScore);
}
}