【发布时间】:2021-03-17 08:16:48
【问题描述】:
我想跟踪在事件订阅中传入的参数,以便在选择/缩小我的调用之后。
public List<Tags> _toSpecificTagSubscribed = new List<Tags>();
private event Action<Tags> _onSpecificTagEvent;
public event Action<Tags> OnSpecificTagEvent {
add {
_onSpecificTagCollision += value;
if (!_toSpecificTagSubscribed.Contains(<TagArgumentValue>))
_toSpecificTagSubscribed.Add(<TagArgumentValue>);
}
remove { _onSpecificTagEvent -= value; }
}
}
请参阅<TagArgumentValue>。这是在订阅的事件本身中传递的,所以我想知道如何访问它。类似于value.<TagArgumentValue>,表示传递给事件的参数值。
这可能吗?怎么样?
【问题讨论】:
标签: c# events eventhandler