I want to update one object with the data from another, so something like:
User updatingUser = Users.Get(someId);
updatingUser.Name = otherUser.Name;
updatingUser.Age = otherUser.Age;
Now I want to create a method to perform this update, do I need a ref in the parameter list?
public static void UpdateUserFromUser(User original, User other)
{
original.Name = other.Name;
original.Age = other.Age;
..
..
}
Now the 'original' user passed in has properties on the object that are set, and that will not be updated, so this user object gets SOME properties updated.
I need a ref correct, like:
public static void UpdateUserFromUser(ref User original, User other)
Or will the object 'original' get updated without the need for ref?