Well recently i came up with an idea (that i really don't know whether it would exist or even work) of automatic updating class's properties using an modified instance of it. And to make my idea a little bit more clear, i will explain it in the code below.
//The first (Main) instance of the class
Employee carl = new Employee();
carl.Name = "Carl";
carl.Age = 20;
carl.Salary = 7000;
//Here is the same employee data collected from the database a year after...
Employee carl_one_year_later = new Employee();
carl_one_year_later.Age = 21;
carl_one_year_later.Salary = 10000;
//Here comes the idea... I wanna dynamically merge the new collected data to the current main instance of the employee, without missing out the unupdated data ex : his name
employee1 = employee2; //using this seems to overwrite the Name Field with null...
Someone might say you can simply achieve this by doing this:
carl.Age = carl_one_year_later.Age;
carl.Salary = carl_one_year_later.Salary;
However, i want a dynamic way to just do this in 1 line of code and let C# handle the property set for me, also it may come in handy if we have a massive class that we don't want to set it's properties every time it is updated one by one.
NB: I hope i succeed in providing a clear image of my idea, and if you find any problem understanding what exactly do i need, just let me know.