Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What are multicast delegates ? give me an example



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

Post New Answer

More Dot Net Framework Interview Questions

What is edm in entity framework?

0 Answers  


What is the meaning of unobtrusive javascript? Explain us by any practical example.

0 Answers  


Explain tempdata in asp.net mvc?

0 Answers  


What are the major improvements provided by the common language runtime and the base class libraries? Or what are the major improvements in .net framework 4.0?

0 Answers  


how do you mark a property as required? For example, for a project, the name is a required field.

0 Answers   Microsoft,


What are Validation Annotations?

0 Answers  


What is the difference between partial and renderpartial?

0 Answers  


What is the main difference between VS 2005 and VS 2003?

5 Answers   CTS, Satyam,


explain lazy loading, eager loading, and explicit loading?

0 Answers   Microsoft,


Is razor a server side?

0 Answers  


What are the new enhancements done in default project template of asp.net mvc 4?

0 Answers  


What is routeconfig.cs in mvc 4?

0 Answers  


Categories