public static void Main() { Person newPerson = new Person(52); Console.WriteLine(newPerson.Name); Console.WriteLine(newPerson.Gender); Console.WriteLine(newPerson.Age); }
public static void Main() { Person firstPerson = new Person(2); Person secondPerson = new Person(3); Console.WriteLine("Name: {0}, age: {1}, gender {2}", firstPerson.Name, firstPerson.Age, firstPerson.PersonGender); Console.WriteLine("Name: {0}, age: {1}, gender {2}", secondPerson.Name, secondPerson.Age, secondPerson.PersonGender); }
public void CreatePerson(int personId) { Person newPerson = new Person(); newPerson.PersonAge = personId; if (personId % 2 == 0) { newPerson.PersonName = "Man"; newPerson.PersonSex = Sex.Male; } else { newPerson.PersonName = "Women"; newPerson.PersonSex = Sex.Female; } }