System.Diagnostics.StackFrameHelper.GetMethodBase C# (CSharp) Method

GetMethodBase() public method

public GetMethodBase ( int i ) : MethodBase
i int
return System.Reflection.MethodBase
        public virtual MethodBase GetMethodBase (int i) 
        { 
            // There may be a better way to do this.
            // we got RuntimeMethodHandles here and we need to go to MethodBase
            // but we don't know whether the reflection info has been initialized
            // or not. So we call GetMethods and GetConstructors on the type
            // and then we fetch the proper MethodBase!!
            RuntimeMethodHandle mh = rgMethodHandle [i];
            
            if (mh.IsNullHandle()) 
                return null;

            mh = mh.GetTypicalMethodDefinition();

            return RuntimeType.GetMethodBase(mh);
        }

Usage Example

Esempio n. 1
0
 private void BuildStackFrame(int skipFrames, bool fNeedFileInfo)
 {
     StackFrameHelper sfh = new StackFrameHelper(fNeedFileInfo, null);
     StackTrace.GetStackFramesInternal(sfh, 0, null);
     int numberOfFrames = sfh.GetNumberOfFrames();
     skipFrames += StackTrace.CalculateFramesToSkip(sfh, numberOfFrames);
     if ((numberOfFrames - skipFrames) > 0)
     {
         this.method = sfh.GetMethodBase(skipFrames);
         this.offset = sfh.GetOffset(skipFrames);
         this.ILOffset = sfh.GetILOffset(skipFrames);
         if (fNeedFileInfo)
         {
             this.strFileName = sfh.GetFilename(skipFrames);
             this.iLineNumber = sfh.GetLineNumber(skipFrames);
             this.iColumnNumber = sfh.GetColumnNumber(skipFrames);
         }
     }
 }
All Usage Examples Of System.Diagnostics.StackFrameHelper::GetMethodBase