Tutorials
Resources
Forum
Interview
Jobs
Projects
Offshore Development
Silverlight Tutorials
|
Mentor
|
Code Converter
|
Articles
|
Code Factory
|
Computer Jokes
|
Members
|
Peer Appraisal
|
IT Companies
|
Bookmarks
|
Revenue Sharing
|
My Profile
Sign In
Register
AdSense Revenue
Gifts
Active Members
Today
Dharmaraj
(22)
Vivek
(15)
vipul
(10)
Last 7 Days
Meetu Choudhar...
(671)
Appukuttan
(512)
Satyanarayan Su...
(464)
more...
Multicast delegates: an example
Posted Date: 05 May 2008 Resource Type:
Articles
Category:
.NET Framework
Posted By:
akhilesh chauhan
Member Level:
Gold
Rating:
Points
: 10
Delegate that can have more than one element in its invocation List.
using System;
namespace SampleMultiCastDelegate
{
class MultiCast
{
public delegate string strMultiCast(string s);
}
}
MainClass defines the static methods having same signature as delegate.
using System;
namespace SampleMultiCastDelegate
{
public class MainClass
{
public MainClass()
{
}
public static string Jump(string s)
{
Console.WriteLine("Jump");
return String.Empty;
}
public static string Run(string s)
{
Console.WriteLine("Run");
return String.Empty;
}
public static string Walk(string s)
{
Console.WriteLine("Walk");
return String.Empty;
}
}
}
The Main class:
using System;
using System.Threading;
namespace SampleMultiCastDelegate
{
public class MainMultiCastDelegate
{
public static void Main()
{
MultiCast.strMultiCast Run,Walk,Jump;
MultiCast.strMultiCast myDelegate;
///here mydelegate used the Combine method of System.MulticastDelegate
///and the delegates combine
myDelegate=(MultiCast.strMultiCast)System.Delegate.Combine(Run,Walk);
}
}
}
Responses
Author:
Sebastian
13 Jun 2008
Member Level:
Gold
Points
: 1
This is very informative. Thanks for sharing the details.
Feedbacks
Popular Tags
What are tags ?
Search Tags
Sign In
(No tags found.)
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:
Advantages of Using ASP.Net over j2ee
Previous Resource:
How to do Randomgeneration of string
Return to Discussion Resource Index
Post New Resource
Category:
.NET Framework
Post resources and
earn money
!
Related Resources
Message Queuing – A boon to Enterprise Network
IsPageRefresh in ASP .NET
Determining operating system version and details
XML Validation using XSD in .Net 2.0
How to Create and Use a simple Custom Control
dotNet Slackers
BizTalk Adaptors
Web Design
online optimum rewards
Contact Us
Privacy Policy
Terms Of Use