When you have source code of the classes under consideration at your hand then things are easy. You probably just add the extra methods to those classes. What if you don't have source code? Well.
In such cases one approach is to inherit the existing classes and add extra methods to the child classes.
However, this way may not be always correct and possible in terms of your application design and OO principles. Luckily, C# offers a quick way to extend your class functionality through a feature known as Extension Methods.
Extension methods allow you to extend existing types without inheriting them.
No comments:
Post a Comment