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
Describe the roles of clr in .net framework.?
Is .net framework 4.8 the last version?
Does .NET Framework support SAX?
Can we change web.config settings from iis?
What is routeconfig.cs in mvc 4?
Which is the root namespace for fundamental types in .net framework?
Asp.net mvc application, makes use of settings at 2 places for routing to work correctly. What are these 2 places?
What are child actions in ASP.Net MVC?
Explain tempdata in mvc?
How we can call a JavaScript function on the change of a Dropdown List in ASP.Net MVC?
What are the levels at which filters can be applied in an asp.net mvc application?
How to Create an Intranet Site Using ASP.NET MVC?
How route table is created in ASP.NET MVC?
Is it possible to cancel filter execution?
What does mvvm mean?