Typeクラスで参照できる型情報には戻り値や引数に関する情報は含まれないため、デリゲート型を表すTypeインスタンスからはデリゲートのシグネチャを直接知ることができない。 そこで、デリゲート型が持つInvokeメソッドのMethodInfoを取得し、そこから必要な情報を参照することでデリゲートのシグネチャを知ることができる。

using System;
using System.Reflection;

class Sample {
  static void Main()
  {
    PrintDelegateSignature(typeof(EventHandler));
    PrintDelegateSignature(typeof(Action<>));
    PrintDelegateSignature(typeof(Func<,,,,>));
    PrintDelegateSignature(typeof(System.Text.RegularExpressions.MatchEvaluator));
  }

  private static void PrintDelegateSignature(Type typeOfDelegate)
  {
    MethodInfo signature = typeOfDelegate.GetMethod("Invoke");

    Console.Write("{0} {1}(", signature.ReturnType.Name, typeOfDelegate.FullName);

    bool first = true;

    foreach (ParameterInfo p in signature.GetParameters()) {
      if (first)
        first = false;
      else
        Console.Write(", ");

      Console.Write("{0} {1}", p.ParameterType.Name, p.Name);
    }

    Console.WriteLine(")");
  }
}
実行結果
Void System.EventHandler(Object sender, EventArgs e)
Void System.Action`1(T obj)
TResult System.Func`5(T1 arg1, T2 arg2, T3 arg3, T4 arg4)
String System.Text.RegularExpressions.MatchEvaluator(Match match)
Imports System
Imports System.Reflection

Class Sample
  Shared Sub Main()
    PrintDelegateSignature(GetType(EventHandler))
    PrintDelegateSignature(GetType(Action(Of)))
    PrintDelegateSignature(GetType(Func(Of ,,,,)))
    PrintDelegateSignature(GetType(System.Text.RegularExpressions.MatchEvaluator))
  End Sub

  Private Shared Sub PrintDelegateSignature(ByVal typeOfDelegate As Type)
    Dim signature As MethodInfo = typeOfDelegate.GetMethod("Invoke")

    Console.Write("{0}(", typeOfDelegate.FullName)

    Dim first As Boolean = True

    For Each p As ParameterInfo in signature.GetParameters()
      If first Then
        first = False
      Else
        Console.Write(", ")
      End If

      Console.Write("{1} As {0}", p.ParameterType.Name, p.Name)
    Next

    Console.WriteLine(") As {0}", signature.ReturnType.Name)
  End Sub
End Class
実行結果
System.EventHandler(sender As Object, e As EventArgs) As Void
System.Action`1(obj As T) As Void
System.Func`5(arg1 As T1, arg2 As T2, arg3 As T3, arg4 As T4) As TResult
System.Text.RegularExpressions.MatchEvaluator(match As Match) As String