C# Delegate örnek

Posted: June 29, 2014 in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
public static void Topla(int x, int y)
{

Console.WriteLine((x+y).ToString());
}

public static void Carp(int x,int y)
{

Console.WriteLine((x * y).ToString());

}

delegate void Temsilci(int x, int y);

public static void Main()
{
Temsilci T_temsilcisi=null;
T_temsilcisi += new Temsilci(Topla);
T_temsilcisi += new Temsilci(Carp);

T_temsilcisi(10,30);
}
}

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s