Extension Methods & its Advantages in C#

extension2

extension1

Extension Methods in C#

Extension Methods were introduced in c# 3.0. These methods are helpful in adding methods to the types which already existed i.e without creating a derived type via inheritance, methods can be added to existing type. In short functionality of existing type is extended.

Creation and Usage of Extension Method   

Extension method can be defined as static method with static class where first parameter in this method is used with “this” modifier and type of this parameter is of the type that is extended.

 

Read more about Extension Methods & its Advantages in C# visit FindNerd.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s