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 is scalar property?
Can you explain renderbody and renderpage in mvc?
Explain tempdata in asp.net mvc?
Which is the default http method for an action method?
Are there any parts of the .net framework 3.0 that only work on windows vista?
What is edm in entity framework?
What are action filters?
What is routeconfig.cs in mvc 4?
Mention some action filters which are used regularly in ASP.Net MVC?
i just want to write an exam regarding .net?plz give me information about taking a test?where to pay 4 d exam,exam centre?
explain how you can load related entities in ef (entity framework)?
Is http stateful or stateless?
what do you mean by table-per-hierarchy?
Describe the gac in the .net framework.
Explain ASP.NET MVC Identity and Security?