What are multicast delegates ? give me an example



What are multicast delegates ? give me an example..

Answer / kirti

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);

}

}

}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Dot Net Framework Interview Questions

What is the benefit of entity framework?

0 Answers  


What is entity sql? : Entity framework

0 Answers  


What is presentation framework?

0 Answers  


Explain Sections is ASP.Net MVC?

0 Answers  


What is Differnce between html.action and ajax.action?

0 Answers   HCL,






What meant of assembly & global assembly cache (gac) & Meta data

1 Answers  


How to Redirect Tracing to a File

0 Answers   HCL,


Is razor a server side?

0 Answers  


i just want to write an exam regarding .net?plz give me information about taking a test?where to pay 4 d exam,exam centre?

0 Answers  


What is meant by tempdata in mvc?

0 Answers  


How we can invoke child actions in ASP.Net MVC?

0 Answers  


What is difference between razor and web form engine?

0 Answers  


Categories