Another great feature in c# 3.0 is Extension Methods. Extension Methods are created in a way that allow developers to inject them in other classes as being part of them. This article will provide an example of this. As you know, the string type has many methods and the length property. But suppose that, for some reason, you wish string objects to have a new method available, say, to add a timestamp on the start of the string. This is where Extension Methods come in handy. An Extension Method that would allow us to do this, is the following: [crayon-51dafc64f334d/] I’ve [...]
↧