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 |
mention what is the key advantage of using entity framework or ef?
What meant of assembly & global assembly cache (gac) & Meta data
how do you mark a property as required? For example, for a project, the name is a required field.
what is namespace?
Which is the institute which also caters to your personal development other than subject.
How do you box a primitive data type variable ?
What is the difference between entity framework and mvc?
what is the three pillar of .Net ?
What is the use of razor view engine?
Which is the best institute for .net?
What is Global Assembly Cache (GAC) and what is the purpose of it?
Is dapper better than entity framework?