System.Linq.Expressions.Error.TypeMustBeDerivedFromSystemDelegate C# (CSharp) Method

TypeMustBeDerivedFromSystemDelegate() static private method

ArgumentException with message like "Type must be derived from System.Delegate"
static private TypeMustBeDerivedFromSystemDelegate ( ) : Exception
return Exception
        internal static Exception TypeMustBeDerivedFromSystemDelegate()
        {
            return new ArgumentException(Strings.TypeMustBeDerivedFromSystemDelegate);
        }
        /// <summary>

Usage Example

        /// <summary>
        /// Creates a <see cref="DynamicExpression" /> that represents a dynamic operation bound by the provided <see cref="CallSiteBinder" />.
        /// </summary>
        /// <param name="delegateType">The type of the delegate used by the <see cref="CallSite" />.</param>
        /// <param name="binder">The runtime binder for the dynamic operation.</param>
        /// <param name="arguments">The arguments to the dynamic operation.</param>
        /// <returns>
        /// A <see cref="DynamicExpression" /> that has <see cref="NodeType" /> equal to
        /// <see cref="ExpressionType.Dynamic">Dynamic</see> and has the
        /// <see cref="DynamicExpression.DelegateType">DelegateType</see>,
        /// <see cref="DynamicExpression.Binder">Binder</see>, and
        /// <see cref="DynamicExpression.Arguments">Arguments</see> set to the specified values.
        /// </returns>
        public static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, IEnumerable <Expression> arguments)
        {
            ContractUtils.RequiresNotNull(delegateType, nameof(delegateType));
            ContractUtils.RequiresNotNull(binder, nameof(binder));
            if (!delegateType.IsSubclassOf(typeof(MulticastDelegate)))
            {
                throw Error.TypeMustBeDerivedFromSystemDelegate();
            }

            var method = GetValidMethodForDynamic(delegateType);

            var args = arguments.ToReadOnly();

            ValidateArgumentTypes(method, ExpressionType.Dynamic, ref args, nameof(delegateType));

            return(DynamicExpression.Make(method.GetReturnType(), delegateType, binder, args));
        }
All Usage Examples Of System.Linq.Expressions.Error::TypeMustBeDerivedFromSystemDelegate
Error