Writing someDelegate(...)
is a compiler shorthand for someDelegate.Invoke(...)
.
They both compile to the same IL—a callvirt
instruction to that delegate type's Invoke
method.
The Invoke
method is generated by the compiler for each concrete delegate type.
By contrast, the DynamicInvoke
method, defined on the base Delegate
type, uses reflection to call the delegate and is slow.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…