##implicit compiler acts on delegates

— Based on http://www.yoda.arachsys.com/csharp/events.html

# MyDelegate d1 = new MyDelegate(this.InstanceMethod1); // when you add this code in a non-static context, the “this.” is implicited added by compiler, but you can add it explicitly

# MyDelegate d2 = new MyDelegate(Class4.StaticMethod2); // the class name, if omitted, is inferred by compiler

# when you call d1(someArg), compiler implicitly calls d1.Invoke(someArg). You do not have to call this method explicitly. Invoke() is useful in reflection. See MSDN

# when you perform d3 = d1 + d2, compiler implicit calls the static Delegate.Combine(d1, d2)
# when you perofrm d3 – d2, compiler implicitly calls Delegate.Remove(d3, d2)


Fill in your details below or click an icon to log in:

WordPress.com 徽标

您正在使用您的 WordPress.com 账号评论。 登出 /  更改 )

Google photo

您正在使用您的 Google 账号评论。 登出 /  更改 )

Twitter picture

您正在使用您的 Twitter 账号评论。 登出 /  更改 )

Facebook photo

您正在使用您的 Facebook 账号评论。 登出 /  更改 )

Connecting to %s