지금까지 생성자 만들어야지 사용가능한줄 알고 있었음


using System;

 

namespace ConsoleApp

{

public class Person

{

public String name;

public Int32 age;

 

public Person() { }

}

 

public class Program

{

static public void Main()

{

// new XXX { ... }

Person p1 = new Person { name = "Anders", age = 10 };

}

}

}