using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
//最简便的
SetLanguage("小明", Changl);
SetLanguage("Jeak", Englist);
//比上一步更加简化
languageDelegate sd= new languageDelegate(Changl);
sd += Englist;
sd += Changl;
SetLanguage("Jeak", sd);
//事件加载 添加了事件
LangueShow += Englist;
SetLanguage("sdsdd", LangueShow);
Console.Read();
}
public delegate void languageDelegate(string name);
public static event languageDelegate LangueShow;
public static void Englist(string name)
{
Console.WriteLine("Welecome "+name);
}
public static void Changl(string name)
{
Console.WriteLine("你好 " + name);
}
public static void SetLanguage(string name, languageDelegate makeLangue)
{
makeLangue(name);
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
//最简便的
SetLanguage("小明", Changl);
SetLanguage("Jeak", Englist);
//比上一步更加简化
languageDelegate sd= new languageDelegate(Changl);
sd += Englist;
sd += Changl;
SetLanguage("Jeak", sd);
//事件加载 添加了事件
LangueShow += Englist;
SetLanguage("sdsdd", LangueShow);
Console.Read();
}
public delegate void languageDelegate(string name);
public static event languageDelegate LangueShow;
public static void Englist(string name)
{
Console.WriteLine("Welecome "+name);
}
public static void Changl(string name)
{
Console.WriteLine("你好 " + name);
}
public static void SetLanguage(string name, languageDelegate makeLangue)
{
makeLangue(name);
}
}
}