MultiCast Delegate Beispiel

Published on: November 15, 2010
Categories: C# C++ und C
Tags: No Tags
Comments: No Comments

MultiCast Delegate Beispiel
class Program
{
public delegate void Operation(int wert1, int wert2);
static void Main(string[] args)
{
klasse x = new klasse();
Operation[] proz = new Operation[2];
proz[0] = new Operation(x.Methode1);
proz[1] = new Operation(x.Methode2);
Operation array = (Operation)Delegate.Combine(proz);
array(1, 2);
Console.ReadLine();
}
class klasse
{
public void Methode1(int x, int y)
{
Console.WriteLine(“1.{0}{1}”,x,y);
}
public void Methode2(int x, int y)
{
Console.WriteLine(“2.{0}{1}”, x, y);
}
}

}

No Comments - Leave a comment

Leave a comment

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Welcome , today is Saturday, May 19, 2012