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 is orm entity framework?
Which filter executes first in an asp.net mvc application?
What operating systems will the .net framework 3.0 be available for?
How do I use partial view?
What is the difference between tempdata and viewbag?
Which are the important namespaces used in mvc?
Explain Model, view and Controllers in Asp.Net MVC?
What is action methods in web api?
What is the significance of nonactionattribute?
I have 2+ years of fake experience,actually i could not answer for project questions..?how can i answer please suggest me..?
What is .net framework used for?
what is use of entity container?
What is layout in mvc?
explain what is ado.net entity framework?
Explain the new features added in version 4 of mvc (mvc4)?