In C#, there are properties so you shouldn't write get/set methods. Assuming your employee class currently looks like this:
class Employee {
private string name;
public string getName() { return this.name; }
public string setName(string name) { this.name = value; }
}
...you could do this instead:
class Employee {
private string name;
public string Name {
get { return this.name; }
set { this.name = value; }
}
}
class Employee {
public string Name { get; set; }
}
To the question in hand, you can do something a little more elegant (hard-coded to delete John here):
Employees.RemoveAll(delegate(Employee E) { return E.Name == "John" && MessageBox.Show("Delete?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes; });
Employees.RemoveAll(E => E.Name == "John" && MessageBox.Show("Delete?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes);