c#事件(2)之相关内容
来源:互联网 发布:nginx ab压力测试工具 编辑:程序博客网 时间:2024/06/08 09:15
//在Interface(接口上实现Event)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//接口实现:事件是基于委托的
namespace Event
{
class Program
{
static void Main(string[] args)
{
I i = new MyClass();
i.MyEvent += new MyDelegate(f);
i.FireAway();
Console.ReadLine();
}
private static void f()
{
Console.WriteLine("This is called where the event fired");
}
}
public delegate void MyDelegate();
public interface I
{
event MyDelegate MyEvent;
void FireAway();
}
public class MyClass:I
{
public event MyDelegate MyEvent;
public void FireAway()
{
if (MyEvent != null)
MyEvent();
}
}
}
0 0
- c#事件(2)之相关内容
- JQuery 事件相关内容练习2
- C#反射相关内容
- JQuery 事件相关内容练习1
- android之launchMode相关内容
- C# 2.0学习之--事件2
- C#之事件
- C#学习之事件
- c#之事件委托
- unity3d c# 之事件
- CSS基本相关内容2
- Struts2之拦截器相关内容
- 相关内容
- C#事件 之 多播事件
- C#学习之生成事件
- C#基础概念之事件
- C#基础概念之事件
- C#之委托和事件
- 第七天 抽屉菜单(性能优化版)
- 关于java数组中某个元素用等号赋值给中间变量需要注意的问题。
- SpringMVC整合MongoDB开发 高级操作
- B/S系统登录记住密码的实现
- 无法访问windows installer服务
- c#事件(2)之相关内容
- sql : case when使用
- 远程数据库拉取相关问题
- iOS之NSKeyedArchiver的序列化存储
- 两个字符串之间进行去除重复的部分
- IOS MD5
- TcpFlow(1.4.6 C++版本)源代码分析
- vs2010编译64位qt5.5
- dbcp重连问题排查