【发布时间】:2010-12-06 19:37:12
【问题描述】:
我在List<T> 中看到的所有使用IndexOf() 方法的示例都是基本字符串类型。我想知道的是如何根据其中一个对象变量返回作为对象的列表类型的索引。
List<Employee> employeeList = new List<Employee>();
employeeList.Add(new Employee("First","Last",45.00));
我想找到employeeList.LastName == "Something"所在的索引
【问题讨论】:
-
有没有办法在没有 lambda 表达式的情况下做到这一点?我被困在使用 .net 2.0
-
你能在下面使用我的解决方案吗?