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


C# Delegate.GetInvocationList方法代码示例

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


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

示例1: ValidateCallback

 // Token: 0x06001860 RID: 6240
 // RVA: 0x00014E5C File Offset: 0x0001305C
 private static void ValidateCallback(Delegate delegate_0)
 {
     if (delegate_0 != null && delegate_0.GetInvocationList().Length > 1)
     {
         throw new NotSupportedException("SmartThreadPool doesn't support delegates chains");
     }
 }
开发者ID:newchild,项目名称:Project-DayZero,代码行数:9,代码来源:WorkItemFactory.cs

示例2: Invoke

        /// <summary>
        /// Invokes a method delegate asynchrounously and thread safe.
        /// </summary>
        /// <param name="method">The delegate method to invoke</param>
        /// <param name="args">The arguments passed to the delegate.</param>
        public static void Invoke(Delegate method, object[] args)
        {
            if (method != null)
            {
                foreach (Delegate handler in method.GetInvocationList())
                {
                    if (handler.Target is Control)
                    {
                        Control target = handler.Target as Control;

                        if (target.IsHandleCreated)
                        {
                            target.BeginInvoke(handler, args);
                        }
                    }
                    else if (handler.Target is ISynchronizeInvoke)
                    {
                        ISynchronizeInvoke target = handler.Target as ISynchronizeInvoke;
                        target.BeginInvoke(handler, args);
                    }
                    else
                    {
                        handler.DynamicInvoke(args);
                    }
                }
            }
        }
开发者ID:ilkerde,项目名称:pipemania,代码行数:32,代码来源:ThreadSafe.cs

示例3: AddTaskDelay

        private static void AddTaskDelay(Delegate ev, object[] paramArray, int time)
        {
            System.Threading.Thread.Sleep(time);
            bool bFired;

            if (ev != null)
            {
                foreach (Delegate singleCast in ev.GetInvocationList())
                {
                    bFired = false;
                    try
                    {
                        ISynchronizeInvoke syncInvoke = (ISynchronizeInvoke)singleCast.Target;
                        if (syncInvoke != null && syncInvoke.InvokeRequired)
                        {
                            bFired = true;
                            syncInvoke.BeginInvoke(singleCast, paramArray);
                        }
                        else
                        {
                            bFired = true;
                            singleCast.DynamicInvoke(paramArray);
                        }
                    }
                    catch (Exception)
                    {
                        if (!bFired)
                            singleCast.DynamicInvoke(paramArray);
                    }
                }
            }
        }
开发者ID:Xileck,项目名称:tibiaapi,代码行数:32,代码来源:Scheduler.cs

示例4: GetDelegateList

        public static Delegate[] GetDelegateList(Delegate del)
        {
            if(del == null) {
                throw new ArgumentNullException("del");
            }

            return del.GetInvocationList();
        }
开发者ID:gratianlup,项目名称:DebugUtils,代码行数:8,代码来源:DelegateHelper.cs

示例5: DisplayDelegateInfo

 public static void DisplayDelegateInfo(Delegate del)
 {
     foreach (var item in del.GetInvocationList())
     {
         Console.WriteLine("Method Name {0}", del.Method);
         Console.WriteLine("Type Name {0}", del.Target);
     }
 }
开发者ID:TatevAghasaryan,项目名称:ToMIC,代码行数:8,代码来源:Program.cs

示例6: ReadDelegate

 private void ReadDelegate( Delegate delObj )
 {
     foreach (Delegate del in delObj.GetInvocationList())
      {
     Console.WriteLine("Method {0}", del.Method);
     Console.WriteLine("Target {0}", del.Target);
      }
 }
开发者ID:ghostmonk,项目名称:CSharpTutorials,代码行数:8,代码来源:DelegationAndSuch.cs

示例7: DisplayDelegateInfo

 static void DisplayDelegateInfo(Delegate delObj)
 {
     foreach (Delegate d in delObj.GetInvocationList())
     {
         Console.WriteLine("Method name: {0}", d.Method);
         Console.WriteLine("Type name: {0}", d.Target);
     }
 }
开发者ID:volkoff-pro,项目名称:Troelsen.CSharp,代码行数:8,代码来源:Program.cs

示例8: GetDelegateDetails

 public static void GetDelegateDetails(Delegate d)
 {
     foreach (Delegate dg in d.GetInvocationList())
     {
         Console.WriteLine("Type is {0}",dg.GetType());
         Console.WriteLine("Method is {0}",dg.Method);
         Console.WriteLine("target is {0}",dg.Target);
     }
 }
开发者ID:ujjwalvaish,项目名称:LearnCSharp-ThroughProjects,代码行数:9,代码来源:Program.cs

示例9: Handle

 private static void Handle(Delegate del, PacketHandlerEventArgs args, params object[] parameters)
 {
     if (del != null)
         foreach (Delegate d in del.GetInvocationList())
         {
             bool? result = (bool?)d.Method.Invoke(d.Target, parameters);
             if (result.HasValue)
                 args.Block = result.Value;
         }
 }
开发者ID:jaryn-kubik,项目名称:RazorEx,代码行数:10,代码来源:Event.Messages.cs

示例10: DelegateMetadata

		/// <summary>
		///   Initializes a new instance.
		/// </summary>
		/// <param name="d">The delegate the info object should be created for.</param>
		public DelegateMetadata(Delegate d)
		{
			Requires.NotNull(d, nameof(d));

			_delegate = d;
			_delegateType = d.GetType();

			var list = d.GetInvocationList();
			_targets = list.Select(info => info.Target).ToArray();
			_methods = list.Select(info => info.Method).ToArray();
		}
开发者ID:isse-augsburg,项目名称:ssharp,代码行数:15,代码来源:DelegateMetadata.cs

示例11: Cast

        private static dynamic Cast(Delegate source, Type type)
        {
            Delegate[] delegates = source.GetInvocationList();
            if (delegates.Length == 1)
                return Delegate.CreateDelegate(type,
                    delegates[0].Target, delegates[0].Method);

            Delegate[] delegatesDest = new Delegate[delegates.Length];
            for (int nDelegate = 0; nDelegate < delegates.Length; nDelegate++)
                delegatesDest[nDelegate] = Delegate.CreateDelegate(type,
                    delegates[nDelegate].Target, delegates[nDelegate].Method);
            return Delegate.Combine(delegatesDest);
        }
开发者ID:distantcam,项目名称:zeromvvm,代码行数:13,代码来源:WindsorComponentRegistrationHelper.cs

示例12: InvokeAsync

 /// <summary>
 /// Invokes every delegate method in new thread (except synchronized handlers).
 /// </summary>
 /// <param name="handler"></param>
 /// <param name="parameters"></param>
 public static void InvokeAsync(Delegate handler, params object[] parameters)
 {
     if (handler != null) {
         foreach (Delegate d in handler.GetInvocationList()) {
             ISynchronizeInvoke sync = d.Target as ISynchronizeInvoke;
             if (sync != null) {
                 sync.BeginInvoke(d, parameters);
             }
             else {
                 ThreadPool.QueueUserWorkItem(new WaitCallback(AsyncInvokeProc), new AsyncInvokeArgs(d.Method, d.Target, parameters));
             }
         }
     }
 }
开发者ID:greeduomacro,项目名称:phoenix,代码行数:19,代码来源:DelegateInvoker.cs

示例13: GetMethodList

        public static MethodInfo[] GetMethodList(Delegate del)
        {
            if(del == null) {
                throw new ArgumentNullException("del");
            }

            Delegate[] delegates = del.GetInvocationList();
            MethodInfo[] methods = new MethodInfo[delegates.Length];

            for(int i = 0; i < delegates.Length; i++) {
                methods[i] = delegates[i].Method;
            }

            return methods;
        }
开发者ID:gratianlup,项目名称:DebugUtils,代码行数:15,代码来源:DelegateHelper.cs

示例14: RaiseEventOnUIThread

 public static void RaiseEventOnUIThread(Delegate theEvent, object[] args)
 {
     foreach (Delegate d in theEvent.GetInvocationList())
     {
         ISynchronizeInvoke syncer = d.Target as ISynchronizeInvoke;
         if (syncer == null)
         {
             d.DynamicInvoke(args);
         }
         else
         {
             syncer.BeginInvoke(d, args);  // cleanup omitted
         }
     }
 }
开发者ID:caiodossantos,项目名称:wireless-network,代码行数:15,代码来源:EventHelper.cs

示例15: CallAsyncMethod

        public static void CallAsyncMethod(Delegate eventDelegate, params object[] args)
        {
            if (eventDelegate != null)
            {
                Delegate[] delegates = eventDelegate.GetInvocationList();

                AsyncInvokeDelegate invoker = new AsyncInvokeDelegate(InvokeDelegate);

                AsyncCallback cleanUp = new AsyncCallback(AsyncDelegateCleanup);

                foreach (Delegate sink in delegates)
                {
                    invoker.BeginInvoke(sink, args, cleanUp, null);
                }
            }
        }
开发者ID:hostitherepc,项目名称:Fork-1,代码行数:16,代码来源:EventUtils.cs


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