And*_*are 4 c# events delegates
注意:这是受WebBrowser Event Properties的启发?
为什么我能够MulticastDelegate在声明事件但不在其外的类型中访问事件的成员?
例如:
using System;
class Bar
{
public static event Action evt;
}
class Program
{
static event Action foo;
static Bar bar;
static void Main()
{
// this works
Delegate[] first = foo.GetInvocationList();
// This does not compile and generates the following
// error:
//
// The event 'Bar.evt' can only appear on the
// left hand side of += or -= (except when used
// from within the type 'Bar')
Delegate[] second = bar.evt.GetInvocationList();
}
}
Run Code Online (Sandbox Code Playgroud)
我觉得这很简单,我没有看到.