Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
0
Reply
Usage of Extension Methods in C# 3.5
Bijayani Baijayanti
Jun 16 2010 9:39 AM
1.7k
Reply
Introduction:
C# 3.0
provides a new feature called Extension Methods. Extension methods are methods that can be added to previously defined classes without rebuilding/compiling those classes.
Process: To define an extension method, we first define a static class, Then we define our static method which is meant to be extended. The first parameter of the extension class should be the type of Object we need to extend.
Syntax:
public static <Return Type> <Function Name>(this <Object Type> <Variable Name>)
{
Do Something
.........
......
return <Return Type> ;
}
Hope you find this tips useful.
Thanks,
Bijayani
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
Developing a network application with C# And SQL SERVER 2005
Enumeration with return of prop name & value