I'm looking for some clarification and confirmation that this is indeed doing nothing.
Say I have an object
public class Person
{
public string Name { get; set; }
}
and I am going to use this object and for some reason it has to be initialized, which should happen in the constructor but for this example its going to happen in a call to an initialize function
public class myClass
{
private void doingSomething()
{
Person p = new Person();
Initialize(p);
}
private void Initialize(Person person)
{
person.Name = "";
}
}
This is just a waste correct. If I really wanted to change the values doesn't it have to be passed using ref, out, or returning a different Person?
If I'm wrong i'd appreciate an explanation. I found this while looking through some old code and feel confused because I can't believe it's there.