当前位置: 首页>>代码示例>>C#>>正文


C# EventHandler.GetMethodInfo方法代码示例

本文整理汇总了C#中EventHandler.GetMethodInfo方法的典型用法代码示例。如果您正苦于以下问题:C# EventHandler.GetMethodInfo方法的具体用法?C# EventHandler.GetMethodInfo怎么用?C# EventHandler.GetMethodInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EventHandler的用法示例。


在下文中一共展示了EventHandler.GetMethodInfo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WeakEventSubscription

        /// <summary>
        /// Initializes a new instance of the <see cref="WeakEventSubscription"/> class.
        /// </summary>
        /// <param name="target">The event handler's owner.</param>
        /// <param name="eventHandler">The event handler.</param>
        /// <param name="subscribeAction">The action to subscribe the event handler.</param>
        /// <param name="unsubscribeAction">The action to unsubscribe the event handler.</param>
        public WeakEventSubscription(object target, EventHandler eventHandler, Action<EventHandler> subscribeAction, Action<EventHandler> unsubscribeAction)
        {
            _unsubscribeAction = unsubscribeAction;

            Method = eventHandler.GetMethodInfo();
            EventHandlerReference = new WeakReference(eventHandler.Target);
            Reference = new WeakReference(target);

            subscribeAction(OnEvent);
        }
开发者ID:HimanshPal,项目名称:Cimbalino-Toolkit,代码行数:17,代码来源:WeakEventSubscription.cs

示例2: UnsubscribeFromStoppingNotifcation

 public void UnsubscribeFromStoppingNotifcation(object handlerObject, EventHandler<object> handler)
 {
     var handlerDelegate = Delegate.CreateDelegate(stoppingEvent.EventHandlerType, handlerObject, handler.GetMethodInfo());
     stoppingEventRemove.Invoke(null, new[] { handlerDelegate });
 }
开发者ID:naeemkhedarun,项目名称:orleans,代码行数:5,代码来源:ServiceRuntimeWrapper.cs

示例3: SubscribeForStoppingNotifcation

 public void SubscribeForStoppingNotifcation(object handlerObject, EventHandler<object> handler)
 {
     var handlerDelegate = handler.GetMethodInfo().CreateDelegate(stoppingEvent.EventHandlerType, handlerObject);
     stoppingEventAdd.Invoke(null, new object[] { handlerDelegate });
     
 }
开发者ID:Joshua-Ferguson,项目名称:orleans,代码行数:6,代码来源:ServiceRuntimeWrapper.cs


注:本文中的EventHandler.GetMethodInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。