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 are html helpers in asp.net mvc?
What are the 3 main components of an asp.net mvc application?
What is viewbag title?
Can you set the unlimited length for "maxjsonlength" property in config?
In razor syntax, what is the escape sequence character for @ symbol?
Are there any parts of the .net framework 3.0 that only work on windows vista?
What is stateless model?
What is web api‘s in asp.net mvc 4 ?
i want to take the fast track training on >net Frame work and work flows and share point could you tellme the good institutes for that cources
What is page life cycle?
Explain covariance and contra-variance in .net framework 4.0. Give an example for each.
Is dapper faster than entity framework?
What is separation of concerns in asp.net mvc?
Mention the core components of .net framework?
What is net framework 3.0 ?