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 |
What is the need of .Net framework ?
Can I redirect tracing to a file
What is objectset? : Entity framework
If we want to construct our own Garbage collector what are the steps things we have to do?
3 Answers Honeywell, Semantic Space,
What is session state management?
How does �side by side� work for the .net framework 3.0?
What is .net framework & its benefits?
When was the first version of .NET released
What is associationset? : Entity framework
How can you return string result from Action in ASP.Net MVC?
What is attribute routing in mvc?
Which is the institute which also caters to your personal development other than subject.