How can I make a property in a class return a certain string if its a certain condition eg/empty
public class Person
{
public string Name{get;set;}
publc string MiddleName{get;set;}
public string Surname{get;set;}
public string Gender{get;set;}
}
List<Person> people = repo.GetPeople();
List<Person> formatted = people.GroupBy(x=>x.Gender).//?? format Gender to be a certain string eg/"Not Defined" if blank
Update: (to catch empty strings)