I have the following class:
public class TestClass {
public string ClassName {
get;
set;
}
}
What's the difference between doing:
var instance = new TestClass();
and doing
var instance = new TestClass { };
I thought you needed to include the () to call the object's constructor. What does that mean?
Edit: Can someone explain which is best? Or if one ignores the constructor, benefits or disadvantages?
Edit2: Sorry if I asked something that was already answered. The difference was somewhat clear to me, but I really didn't understand how I could mix and match () and {}, since sometimes the () are ignored and I wanted to know when I could do so