Delegate vs. delegate keyword

前端 未结 6 2061
长情又很酷
长情又很酷 2020-12-13 03:51

If you like to create custom delegates you would use the delegate keyword in lowercase.

What can you do with the actual Delegate Class? Wh

6条回答
  •  春和景丽
    2020-12-13 04:42

    From http://msdn.microsoft.com/en-us/library/system.delegate.aspx:

    The Delegate class is the base class for delegate types. However, only the system and compilers can derive explicitly from the Delegate class or from the MulticastDelegate class. It is also not permissible to derive a new type from a delegate type. The Delegate class is not considered a delegate type; it is a class used to derive delegate types.

    Most languages implement a delegate keyword, and compilers for those languages are able to derive from the MulticastDelegate class; therefore, users should use the delegate keyword provided by the language.

提交回复
热议问题