Mono.CSharp.TypeManager.IsDelegateType C# (CSharp) Method

IsDelegateType() public static method

public static IsDelegateType ( System.TypeSpec t ) : bool
t System.TypeSpec
return bool
	public static bool IsDelegateType (TypeSpec t)
	{
		return t.IsDelegate;
	}
	

Usage Example

Example #1
0
        public override Expression DoResolve(ResolveContext ec)
        {
            if (Arguments == null || Arguments.Count != 1)
            {
                ec.Report.Error(149, loc, "Method name expected");
                return(null);
            }

            Argument a = Arguments [0];

            if (!a.ResolveMethodGroup(ec))
            {
                return(null);
            }

            Expression e = a.Expr;

            AnonymousMethodExpression ame = e as AnonymousMethodExpression;

            if (ame != null && RootContext.Version != LanguageVersion.ISO_1)
            {
                e = ame.Compatible(ec, type);
                if (e == null)
                {
                    return(null);
                }

                return(e.Resolve(ec));
            }

            method_group = e as MethodGroupExpr;
            if (method_group == null)
            {
                if (!TypeManager.IsDelegateType(e.Type))
                {
                    e.Error_UnexpectedKind(ec, ResolveFlags.MethodGroup | ResolveFlags.Type, loc);
                    return(null);
                }

                //
                // An argument is not a method but another delegate
                //
                delegate_instance_expression = e;
                method_group = new MethodGroupExpr(new MemberInfo [] {
                    Delegate.GetInvokeMethod(ec.Compiler, ec.CurrentType, e.Type)
                }, e.Type, loc);
            }

            return(base.DoResolve(ec));
        }
All Usage Examples Of Mono.CSharp.TypeManager::IsDelegateType