用List<T>的Find方法有点不明白
using System;
using System.Collections.Generic;
using System.Text;
namespace _CSharp_Console
{
class Employee
{
string name;
string position;
public string Name
{
get { return name; }
}
public string Position
{
get { return position; }
}
public Employee(string name, string position)
{
this.name = name;
this.position = position;
}
public override string ToString()
{
return "Name: " + name + "\tPosition: " + position;
}
}
class Program
{
static void Main(string[] args)
{
List <Employee> empList = new List <Employee> ();
empList.Add(new Employee( "Name1 ", "CEO "));
empList.Add(new Employee( "Name2 ", "CTO "));
empList.Add(new Employee( "Name3 ", "CFO "));
empList.Add(new Employee( "Name4 ", "COO "));
empList.Add(new Employee( "Name5 ", "CEO "));
Console.WriteLine(empList.Find(FindOne));