Check if an ITypeSymbol is a delegate type

Viewed 70

How can I check if an ITypeSymbol instance refers to a delegate type (like Action or Func<T>).

I think I can check if the base type is System.Delegate. Is this the correct way to do so or is there a better solution?

1 Answers

Check its TypeKind:

typeSymbol.TypeKind == TypeKind.Delegate;
Related