System.Reflection.Emit.ILGenerator.BeginExceptionBlock C# (CSharp) Method

BeginExceptionBlock() public method

public BeginExceptionBlock ( ) : System.Reflection.Emit.Label
return System.Reflection.Emit.Label
        public virtual System.Reflection.Emit.Label BeginExceptionBlock() { throw null; }
        public virtual void BeginFaultBlock() { }

Usage Example

示例#1
0
        private void CopyTryCatch(ILGenerator Gen, int i, MethodBody Body, List<int> ExceptionTrinkets)
        {
            // Quick check to see if we want to walk through the list
            if (!ExceptionTrinkets.Contains(i)) return;

            foreach (ExceptionHandlingClause Clause in Body.ExceptionHandlingClauses)
            {
                if (Clause.Flags != ExceptionHandlingClauseOptions.Clause &&
                   Clause.Flags != ExceptionHandlingClauseOptions.Finally)
                    continue;

                // Look for an ending of an exception block first!
                if (Clause.HandlerOffset + Clause.HandlerLength == i)
                    Gen.EndExceptionBlock();

                // If this marks the beginning of a try block, emit that
                if (Clause.TryOffset == i)
                    Gen.BeginExceptionBlock();

                // Also check for the beginning of a catch block
                if (Clause.HandlerOffset == i && Clause.Flags == ExceptionHandlingClauseOptions.Clause)
                    Gen.BeginCatchBlock(Clause.CatchType);

                // Lastly, check for a finally block
                if (Clause.HandlerOffset == i && Clause.Flags == ExceptionHandlingClauseOptions.Finally)
                    Gen.BeginFinallyBlock();
            }
        }
All Usage Examples Of System.Reflection.Emit.ILGenerator::BeginExceptionBlock