Answer Posted / 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 View All Answers
What are Validation Annotations?
How to Create an Intranet Site Using ASP.NET MVC?
Explain the types of Scaffoldings.
In Server how to check whether model has error or not in ASP.Net MVC
What are action filters?
Explain what platforms does the .net framework run on?
what is model first approach?
What are actions in asp.net mvc?
Is entity framework slow?
What is viewbag title?
What is action methods in web api?
What is needed for running an application built on winfx on the .net framework 3.0?
Does Tempdata hold the data for other request in ASP.Net MVC?
What is asp net framework?
How can we determine action invoked from HTTP GET or HTTP POST?