event.cs
来自「Gibphone is CSharp Program, it can tell 」· CS 代码 · 共 38 行
CS
38 行
using System;
using System.Collections.Generic;
using System.Text;
namespace GPCore.Protocols
{
public class Event<TProtocol,TEventArgs>
where TProtocol : IProtocol
where TEventArgs : EventArgs
{
private string name;
public string Name
{
get { return name; }
}
public Event(string name) { this.name = name; }
public delegate void Method(TProtocol sender, TEventArgs args);
private static List<Method> list;
public static List<Method> InvocationList
{
get { return list; }
}
public void Fire(TProtocol sender, TEventArgs args)
{
foreach (Method m in list)
{
m(sender, args);
}
}
public void Register(Method m)
{
list.Add(m);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?