C#定义静态事件
来源:互联网 发布:sql union group 编辑:程序博客网 时间:2024/05/25 05:36
class Employee
{
public delegate void DelEvent(int ID);
public static event DelEvent PlayEvent;
public int ID { get; set; }
public Employee(int id)
{
ID = id;
Play(id);
}
public void Play(int ID)
{
PlayEvent(ID);
}
}
class MainProgram
{
static void Main()
{
Employee.PlayEvent += new Employee.DelEvent(Employee_PlayEvent);
for (int i = 0; i < 10; ++i)
{
Employee employee = new Employee(i);
}
Console.ReadKey();
}
static void Employee_PlayEvent(int ID)
{
Console.WriteLine("Employee " + ID.ToString() + " is Playing game!");
}
}
{
public delegate void DelEvent(int ID);
public static event DelEvent PlayEvent;
public int ID { get; set; }
public Employee(int id)
{
ID = id;
Play(id);
}
public void Play(int ID)
{
PlayEvent(ID);
}
}
class MainProgram
{
static void Main()
{
Employee.PlayEvent += new Employee.DelEvent(Employee_PlayEvent);
for (int i = 0; i < 10; ++i)
{
Employee employee = new Employee(i);
}
Console.ReadKey();
}
static void Employee_PlayEvent(int ID)
{
Console.WriteLine("Employee " + ID.ToString() + " is Playing game!");
}
}
- C#定义静态事件
- C#事件-定义事件
- c#事件的定义
- c#静态事件示例
- C#定义属性-静态属性
- C#定义属性-静态属性
- C#学习:事件处理与定义事件
- C#中的事件定义与处理
- C#事件与委托定义与使用
- C#委托事件定义调用实例
- c#事件的定义和使用
- C# 在类中定义事件
- C#如何定义一个事件,实现事件的调用
- c#如何在类中定义静态变量
- C#中定义一个事件和对其的调用
- 深入理解C#中的委托和事件:委托的定义
- Effective C# Item22:使用事件定义外发接口
- C#类对象的事件的定义和使用案例
- src.rpm如何安装
- msp430f149学习心得之一 时钟配置
- Microsoft Patterns & Practices系列书籍就如何采用Windows Azure提供指导
- opencv与videoInput
- delphi调用C# Webservice返回数据集
- C#定义静态事件
- Java中简单的排列组合
- ImageFlow相片特效套件
- Linux用户进程间通信机制在内核的实现
- 智力题
- CStatic
- spi概念
- 单点登陆(CAS)学习
- webservice中wsdl文件使用