I have the following class:
public class Person
{
public String Name { get; set; }
}
I have a method that takes in Person
and a String
as parameters:
public void ChangeName(Person p, String name)
{
p.Name = name;
}
Since Person
was passed by reference, it should change the Name
of the passed instance.
But is this method more readable than the one above?
public Person ChangeName(Person p, String name)
{
p.Name = name;
return p;
}