解决方案 »

  1.   

    List是保存在系统内存里,查询理论上不会慢到哪去
    可以用LINQ2Objectvar q=list.Where(x=>x.Id==1);
      

  2.   

    4.0及以上可以用Where,Find,或者linq来查询访问
    这里贴点简单示例,没遵循语言规范的命名规则,请勿喷…… class Program
        {
            static void Main(string[] args)
            {
                List<Student> students = new List<Student>();
                students.Add(new Student() {Name="A",Sex="Man",Age="12" });
                students.Add(new Student() { Name = "B", Sex = "Man", Age = "13" });
                students.Add(new Student() { Name = "C", Sex = "Man", Age = "14" });
                students.Add(new Student() { Name = "D", Sex = "Man", Age = "15" });
                //一种访问方法,迭代访问
                foreach (Student student in students)
                    Console.WriteLine("Name:"+student.Name+"Sex:"+student.Sex+"Age:"+student.Age+"\n\t");
                //循环输出A B C D的属性
                Console.ReadLine();
                //一种是按所在List数组的索引序号访问
                Console.WriteLine(students[2].Name);
                //输出C
                Console.ReadLine();
                //一种是用linq查询访问
                var s = from student in students
                        where student.Name == "B"
                        select student;
                foreach(Student B in s)
                Console.WriteLine("Name:"+B.Name+"Sex:"+B.Sex+"Age:"+B.Age);
                //输出B ,Man,13
                Console.ReadLine();
                //一种是用Find函数
                Student C = students.Find(x => x.Name == "C");
                Console.WriteLine(C.Name+ C.Age+C.Sex);
                //输出C的属性
                Console.ReadLine();
                //一种是用Where函数
                Student D = students.Where(x => x.Name == "D").First();
                Console.WriteLine(D.Name + D.Age + D.Sex);
                //输出D的属性
                Console.ReadLine();
            }
        }
       public class Student
        {
            public string Name { get; set;}
            public string Sex { get; set; }
            public string Age { get; set; }
        }
      

  3.   

    最快速应该使用Dictionary,并且对查找条件做Hash放入Key。
      

  4.   

    可以用linq,但是linq是个耗资源的东西。
      

  5.   

    http://hi.baidu.com/giorfoicrdbnpxq/item/f2fee938b846c026b2c0c5de
      

  6.   

    要看你说的查找是什么情况了。
    如果是精确匹配,那用哈希表最快了,可以用HashSet<T>.如果是其他匹配方式或条件查询的话,要不你用linq,要不自己优化匹配算法。比如字符串模式匹配算法。