System.Diagnostics.StackFrame.GetFileName C# (CSharp) Method

GetFileName() public method

public GetFileName ( ) : string
return string
        public virtual string GetFileName() { throw null; }
        public virtual int GetILOffset() { throw null; }

Usage Example

Esempio n. 1
0
    public void TraceStack(System.Diagnostics.StackFrame stackFrame)
    {
        var    method     = stackFrame.GetMethod();
        string className  = method.DeclaringType.Name;
        string methodName = method.Name;
        Regex  regEx      = new Regex(@"(.+)\+\<(.+)\>");
        var    match      = regEx.Match(method.DeclaringType.ToString());

        if (match.Success)
        {
            className  = match.Groups[1].Value;
            methodName = match.Groups[2].Value;
        }

        mCallStackBuilder.Length = 0;
        mCallStackBuilder.AppendFormat
        (
            "at {0}.{1} () [0x0000] in {2}:{3}",
            className,
            methodName,
            stackFrame.GetFileName(),
            stackFrame.GetFileLineNumber()
        );

        mCallStackFrames.Push(mCallStackBuilder.ToString());
    }
All Usage Examples Of System.Diagnostics.StackFrame::GetFileName