public static Person Parse(string str) { var person = new Person(); person.Name = str; return person; }
static void Main() { Person person1 = new Person("Petur Pertov", 20); Console.WriteLine(person1); Person person2 = new Person("Petur Pertov", 20, "asd@"); Console.WriteLine(person2); }
public static Person Parse(string str) { var person = new Person {Name = str}; return person; }
/// <summary> /// Use this function to initialise an instance of the Person class, with the name set to the argument passed. /// </summary> /// <param name="Input - Name to initialise the Person class with..."></param> /// <returns>An initialised instance of the Person script</returns> public static Person Parse(string input) { var person = new Person(); person.name = input; return person; }