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 conceptual model? : Entity framework
what is client wins and store wins mode in entity framework concurrency?
Can you explain renderbody and renderpage in mvc?
What are the new enhancements done in default project template of asp.net mvc 4?
Explain how you can implement Ajax in MVC?
What is the use of the default route?
Which is the root namespace for fundamental types in .net framework?
What are the advantages of mvc over asp.net?
What is iobjectset? : Entity framework
differences between poco, model first and data first approach?
What symbol would you use to denote, the start of a code block in razor views?
What is the meaning of unobtrusive javascript?
What is edm in entity framework?
What is session state management?
Explain the role of assembly in the .net framework.