查找类的索引:
我知道找到 List 索引的唯一方法是
int index = listEmployee.FindIndex(
delegate(Employee findEmployee)
{
return findEmployee.Name.Equals(findName, StringComparison.Ordinal);
});
我想知道如何添加要使用的选项
int indexT = listEmployee.FindIndex(r >= r.Name == findName);
或者基本上我做错了什么,我不能使用它。
class Employee
{
private string _name; private int _idNumber;
private string _deptarment; private string _position;
public Employee()
{
_name = ""; _idNumber = 0; _deptarment = ""; _position = "";
}
public string Name
{
get { return _name; }
set { _name = value; }
}
public int IdNumber
{
get { return _idNumber; }
set { _idNumber = value; }
}
public string Department
{
get { return _deptarment; }
set { _deptarment = value; }
}
public string Position
{
get { return _position; }
set { _position = value; }
}
}