What are multicast delegates ? give me an example
Answer / 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 |
What does 'managed' mean in the .NET context
What is NonActionAttribute ?
how can you enhance the performance of entity framework?
How do you do role based security ?
1 Answers Accenture, BirlaSoft,
What is the necessity for singning an assembly with a strong name?
What is "out" parameter how it is used in methods?
Explain RenderBody and RenderPage in ASP.Net MVC?
What is storage model? : Entity framework
what is VSS? Where we are using?
what is mean by COM (component object model) and component based software development? Is it .NET is first COM based technology? Please answer me. Advance thanks.
If you are using components in your application, how can you handle exceptions raised in a component ?
4 Answers Accenture, BirlaSoft,
Is .net framework backwards compatible?