System.Linq.Expressions.Error.ArgumentTypeCannotBeVoid C# (CSharp) Метод

ArgumentTypeCannotBeVoid() статический приватный Метод

ArgumentException with message like "Argument type cannot be void"
static private ArgumentTypeCannotBeVoid ( ) : Exception
Результат System.Exception
        internal static Exception ArgumentTypeCannotBeVoid()
        {
            return new ArgumentException(Strings.ArgumentTypeCannotBeVoid);
        }
        /// <summary>

Usage Example

        private static void ValidateDynamicArgument(Expression arg, string paramName, int index)
        {
            ExpressionUtils.RequiresCanRead(arg, paramName, index);
            var type = arg.Type;

            ContractUtils.RequiresNotNull(type, nameof(type));
            TypeUtils.ValidateType(type, nameof(type));
            if (type == typeof(void))
            {
                throw Error.ArgumentTypeCannotBeVoid();
            }
        }
Error