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

ArgumentException with message like "Type must be System.Void for this label argument"
static private LabelTypeMustBeVoid ( string paramName ) : Exception
paramName string
Результат System.Exception
Пример #1
0
 /// <summary>
 /// Creates a <see cref="LoopExpression"/> with the given body.
 /// </summary>
 /// <param name="body">The body of the loop.</param>
 /// <param name="break">The break target used by the loop body.</param>
 /// <param name="continue">The continue target used by the loop body.</param>
 /// <returns>The created <see cref="LoopExpression"/>.</returns>
 public static LoopExpression Loop(Expression body, LabelTarget @break, LabelTarget @continue)
 {
     RequiresCanRead(body, nameof(body));
     if (@continue != null && @continue.Type != typeof(void))
     {
         throw Error.LabelTypeMustBeVoid();
     }
     return(new LoopExpression(body, @break, @continue));
 }
Пример #2
0
        public static GotoLabelCSharpStatement GotoLabel(LabelTarget target)
        {
            RequiresNotNull(target, nameof(target));

            if (target.Type != typeof(void))
            {
                throw LinqError.LabelTypeMustBeVoid();
            }

            return(new GotoLabelCSharpStatement(target));
        }
Пример #3
0
        internal static void ValidateLoop(Expression body, LabelTarget @break, LabelTarget @continue)
        {
            if (@break != null && @break.Type != typeof(void))
            {
                // DESIGN: C# statement behavior; can be revisited.
                throw LinqError.LabelTypeMustBeVoid();
            }

            if (@continue != null && @continue.Type != typeof(void))
            {
                throw LinqError.LabelTypeMustBeVoid();
            }

            if (@break != null && @continue != null && @break == @continue)
            {
                throw Error.DuplicateLabels();
            }
        }