Tutorials
Resources
Forum
Reviews
Communities
Interview
Jobs
Projects
Training
Your
Ad
Here
Silverlight Games
|
Mentor
|
Code Converter
|
Articles
|
Code Factory
|
Computer Jokes
|
Members
|
Peer Appraisal
|
IT Companies
|
Bookmarks
|
Polls
|
Revenue Sharing
|
Lobby
|
Gift Shop
|
Prizes & Awards
My Profile
Sign In
Register
AdSense Revenue
Active Members
Today
Alwyn
(54)
Nadheera V
(40)
Abhisek Panda
(40)
Last 7 Days
Alwyn
(718)
nishithraj
(512)
Gaurav Arora
(501)
more...
Resources
»
Articles
»
ASP.NET/Web Applications
»
Huge description of delegates
Posted Date: 01 Dec 2008
Resource Type:
Articles
Category:
ASP.NET/Web Applications
Author:
gowthami chowdary
Member Level:
Gold
Rating:
Points
: 7
A delegate is used to represent any function.Delegates are similar to function pointers in c++.We use delegate keyword to create a delegate.To work with delegate we use the following steps:
1.create a delegate
2.Instantiate a delegate
3.Invoke a delegate
EX: If we take a function like
public void display(string s)
{
}
If we want to use a delegate, to refer the above function then we use the following steps.
1.Create a delegate:
Syntax:
Access modifier delegate return type delegate name([arg])
ex:
public delegate void sample delegate (string s)
when we create a delegate:
Access modifier,return type, number of arguments and their data types of the delegates must and should be same as the function that we want to refer.
2.Instantiate delegate:
syntax:
delegate name object name = new delegate name(target function name);
ex:
sample delegate obj=new sample delegate(display);
3.Instantiate the delegate:
syntax:
delegate object([argument value]);
ex:
obj("welcome");
Types of delegates:
1.Single caste delegates
2.Multi cast deligate
If a delegate is used to represent a single function then delegation is known as single caste delegate.
If a delegate is used to represent more than one function then it is known as multi caste delegate.
Responses
No responses found. Be the first to respond and make money from
revenue sharing program
.
Feedbacks
Popular Tags
What are tags ?
Search Tags
Sign In
to add tags.
.net
.
Post Feedback
This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must
Sign In
to post a response.
Next Resource:
About Base Class Libraries
Previous Resource:
Adding Colored Items to Dropdown Using Javascript and Change Page Background
Return to Discussion Resource Index
Post New Resource
Category:
ASP.NET/Web Applications
Post resources and
earn money
!
More Resources
About Base Class Libraries
How to dynamically create controls using asp.net
AutoEventWireup property in asp.net
Exception Handling Mechanism
Process of adding RSS to website
GridView FAQ's
dotNet Slackers
About Us
Contact Us
Privacy Policy
Terms Of Use