Given:
List names = new List(); //list full of names public void RemoveName(string name) { List n = names.Where(x => x
var n = names.SingleOrDefault(x => x.UserName == name) if(n != null && n.UserName.length > 0) { names.Remove(n); }
OR
var n= names.Where(x => x.UserName == name).First(); names.Remove(n)