Object And Refrence
When you are thinking about .net Think about object.
scenario you have initiated an object of user profile in some layer and returning it to main.
|public class xxx
public static UserProfile GetUserProfileByID(long id)
UserProfile u = new UserProfile();
// some code to populate user profile object
Above method when called returns object of UserProfil. So many users accept it like below
|UserProfile user = new UserProfile() // Don;t instantiate new instance as you your method is returning new instance for you.
user = xxx.GetUserProfile();
correct way is simply referto already instantiated object no need to create multiple instances.
|UserProfile user = xxx.GetUserProfile();
This makes sense. Isn''t it ?