I have a question regarding initializing a property in c#.
I have a property called FirstName. I am then asked to initialize the property. The are two different ways to do it, but I do not understand the different outcome of it. Is one way better than the other?
Person perOne = new Person()
The first way to do it is to do it using the constructor like this:
public Person()
{
FirstName = "Edward";
}
The second way to do it would be to use the object like this:
perOne.FirstName = "Edward";
Is it correct to say that the difference would be that the second way creates the FirstName of the object, while the first way just create a general FirstName (even though it was created inside the constructor used to create the object)?