"抓住"这个活动是什么意思?你可以做的一件事是公开你自己的事件,它只是将订阅/取消订阅传递给另一个:
public event DataReceivedEventHandler DataReceived { add { realEventSource.DataReceived += value; } remove { realEventSource.DataReceived -= value; } }
有关事件的更多详细信息,请阅读我关于该主题的文章 - 如果有任何不清楚的地方,请告诉我.
编辑:这是VB.NET中的等价物:
Public Custom Event DataReceived As DataReceivedEventHandler AddHandler(ByVal value As DataReceivedEventHandler) AddHandler Me.realEventSource.DataReceived, value End AddHandler RemoveHandler(ByVal value As DataReceivedEventHandler) RemoveHandler Me.realEventSource.DataReceived, value End RemoveHandler RaiseEvent(ByVal sender as Object, ByVal args as DataReceivedEventArgs) Throw New NotSupportedException End RaiseEvent End Event