System.Linq.Expressions.Error.TryMustHaveCatchFinallyOrFault C# (CSharp) Méthode

TryMustHaveCatchFinallyOrFault() static private méthode

ArgumentException with message like "try must have at least one catch, finally, or fault clause"
static private TryMustHaveCatchFinallyOrFault ( ) : Exception
Résultat Exception
        internal static Exception TryMustHaveCatchFinallyOrFault()
        {
            return new ArgumentException(Strings.TryMustHaveCatchFinallyOrFault);
        }
        /// <summary>

Usage Example

Exemple #1
0
        // MakeTry: the one factory that creates TryStatement
        public static TryExpression MakeTry(Expression body, Expression @finally, Expression fault, IEnumerable <CatchBlock> handlers)
        {
            RequiresCanRead(body, "body");

            var @catch = handlers.ToReadOnly();

            ContractUtils.RequiresNotNullItems(@catch, "handlers");

            if (fault != null)
            {
                if (@finally != null || @catch.Count > 0)
                {
                    throw Error.FaultCannotHaveCatchOrFinally();
                }
                RequiresCanRead(fault, "fault");
            }
            else if (@finally != null)
            {
                RequiresCanRead(@finally, "finally");
            }
            else if (@catch.Count == 0)
            {
                throw Error.TryMustHaveCatchFinallyOrFault();
            }

            return(new TryExpression(body, @finally, fault, @catch));
        }
All Usage Examples Of System.Linq.Expressions.Error::TryMustHaveCatchFinallyOrFault
Error