这样测试LINQ普通查询的效率对不对?
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Collections;using System.Diagnostics;namespace ConsoleApplication11{ class Program { static void Main(string[] args) { List<Test> list = new List<Test>(); Test t; for (int i = 0; i < 10000000; i++) { t = new Test() { MyInt = i, MyString = i.ToString() }; list.Add(t); } Debug.WriteLine(DateTime.Now); for (int i = 0; i < list.Count; i++) { if (list[i].MyString == "9999999") { t = list[i]; break; } } Debug.WriteLine(DateTime.Now); var item = from temp in list where temp.MyString == "9999999" select temp; foreach (var it in item) { } Debug.WriteLine(DateTime.Now); } } public class Test { public int MyInt { get; set; } public string MyString { get; set; } }}