Friday, February 09, 2007

Consider the following , iam working in a project and i made a class and i made a simple method inside this class after small period i wanted to modify or add something in this method all what i have to do just back to the code of this function and modify its code , this is good

but what if this Method was in dll or was in a sealed class or i wanted to add method in a class of the primitive data types ? what can i do ?? the Extension Method was the Solution.eg.. i want to add a small Method to the string type which return the second word in a given string it will be like this

hi Essawy , Read The Note Num2 Carefully (Add this keyword before the type of the argument you want to extend. ) i extended the string Class in the prev. eg. about how Beta Class Joined the string Class .. this is the job of extension Method.

About us

We are a group of bloggers from Faculty of Computers & Information, Helwan University. We have a passion for technology, enjoy programming and we enjoy blogging. This blog is the result of combining those skills and the desire to share our knowledge with others.