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 |
give the feature of .net2.0 over .net1.1
What happens when you encounter a continue statement inside the for loop ?
What is a view engine?
Why is XmlSerializer so slow
Difference between manifest , metadata?
3 Answers Soma Technology, TCS,
What is GC (Garbage Collection) and how it works
What is an asynchronous controller in asp.net mvc?
How .net assemblies are registred as private and shared assembly ?
what is VSS? Where we are using?
Is .net core faster than .net framework?
Describe the roles of clr in .net framework.?
How large is the .net framework 3.0? Does this change make the release larger?