Friday, September 30, 2016

Modify object rather than properties

We had a class named Account with members like Name, Email and Alternate Email. I added a method to update Alternate Email. But Matt suggested making an abstract class (so no instantiation from there) and the updatable properties would have get; set; but the ones that are not updatable are only get; (read only).

Therefore later on you can inherit form Account and pass the entire object to an Update method and only update the updatable fields rather than have update method for each updatable field.

No comments:

Post a Comment