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

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

ArgumentException with message like "Label type must be System.Void if an expression is not supplied"
static private LabelMustBeVoidOrHaveExpression ( string paramName ) : Exception
paramName string
Результат System.Exception
        internal static Exception LabelMustBeVoidOrHaveExpression(string paramName)
        {
            return new ArgumentException(Strings.LabelMustBeVoidOrHaveExpression, paramName);
        }
        /// <summary>

Usage Example

Пример #1
0
        private static void ValidateGoto(LabelTarget target, ref Expression value, string targetParameter, string valueParameter, Type type)
        {
            ContractUtils.RequiresNotNull(target, targetParameter);
            if (value == null)
            {
                if (target.Type != typeof(void))
                {
                    throw Error.LabelMustBeVoidOrHaveExpression(nameof(target));
                }

                if (type != null)
                {
                    TypeUtils.ValidateType(type, nameof(type));
                    if (type.IsByRef)
                    {
                        throw Error.TypeMustNotBeByRef(nameof(type));
                    }

                    if (type.IsPointer)
                    {
                        throw Error.TypeMustNotBePointer(nameof(type));
                    }
                }
            }
            else
            {
                ValidateGotoType(target.Type, ref value, valueParameter);
            }
        }
All Usage Examples Of System.Linq.Expressions.Error::LabelMustBeVoidOrHaveExpression
Error