Delegate.GetInvocationList Method ()


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Returns the invocation list of the delegate.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

public virtual Delegate[] GetInvocationList()

Return Value

Type: System.Delegate[]

An array of delegates representing the invocation list of the current delegate.

Each delegate in the array represents exactly one method.

The order of the delegates in the array is the same order in which the current delegate invokes the methods that those delegates represent.

The following example assigns three methods to a delegate. It then calls the GetInvocationList method to get a total count of the methods assigned to the delegate, to execute the delegates in reverse order, and to execute the methods whose name do not include the substring "File".

using System;
using System.IO;
using System.Reflection;
using System.Windows.Forms;

public class Example
   public static void Main()
      Action<String> outputMessage = null;
      outputMessage += Console.WriteLine;
      outputMessage += OutputToFile;
      outputMessage += ShowMessageBox;

//       Dim output1 As Action(Of String) = AddressOf Console.WriteLine
//       Dim output2 As Action(Of String) = AddressOf OutputToFile 
//       Dim output3 As Action(Of String) = AddressOf MessageBox.Show
//       outputMessage = [Delegate].Combine( { output1, output2, output3 } )
      Console.WriteLine("Invocation list has {0} methods.", 

      // Invoke delegates normally.
      outputMessage("Hello there!");
      Console.WriteLine("Press <Enter> to continue...");

      // Invoke each delegate in the invocation list in reverse order.
      for (int ctr = outputMessage.GetInvocationList().Length - 1; ctr >= 0; ctr--) {
         var outputMsg = outputMessage.GetInvocationList()[ctr];
         outputMsg.DynamicInvoke("Greetings and salutations!");
      Console.WriteLine("Press <Enter> to continue...");

      // Invoke each delegate that doesn't write to a file.
      for (int ctr = 0; ctr < outputMessage.GetInvocationList().Length; ctr++) {  
         var outputMsg = outputMessage.GetInvocationList()[ctr];
         if (! outputMsg.GetMethodInfo().Name.Contains("File"))
            outputMsg.DynamicInvoke( new String[] { "Hi!" } );


   private static void OutputToFile(String s)
      var sw = new StreamWriter(@".\output.txt");

   private static void ShowMessageBox(String s)


when invoked late-bound through mechanisms such as Type.InvokeMember. Associated enumeration: ReflectionPermissionFlag.MemberAccess

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top