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 edm in entity framework?
Mention what is the difference between “ActionResult” and “ViewResult” ?
What are the new enhancements done in default project template of asp.net mvc 4?
What is entity graph? : Entity framework
Where are the routing rules defined in an asp.net mvc application?
what is entity data model?
what is more complex to implement property, methods or event? how can I define criteria to compare the difficulty of implementation between them? for example the number of methods wanted to implements property is 2 methods. how many methods I need it to implements events?
What is model first? : Entity framework
How can you return string result from Action in ASP.Net MVC?
What is the difference between model and entity?
What operating systems will the .net framework 3.0 be available for?
Can any particular component of .net framework 3.0 be removed?
What is difference between Viewbag and Viewdata in ASP.NET MVC?
What is the version number for the next version of the .net framework, codenamed �orcas�?
What is page life cycle?