// If the type is a delegate type, it returns it. If the type is an // expression tree type associated with a delegate type, it returns // the delegate type. Otherwise, null. public static NamedTypeSymbol GetDelegateType(this TypeSymbol type) { if ((object)type == null) { return(null); } if (type.IsExpressionTree()) { type = ((NamedTypeSymbol)type).TypeArguments[0]; //TypeArgumentsNoUseSiteDiagnostics[0]; } return(type.IsDelegateType() ? (NamedTypeSymbol)type : null); }
public static MethodSymbol DelegateInvokeMethod(this TypeSymbol type) { Debug.Assert((object)type != null); Debug.Assert(type.IsDelegateType() || type.IsExpressionTree()); return((MethodSymbol)type.GetDelegateType().DelegateInvokeMethod); }