publicstaticvoidDebugFunctionTree(stringmessage){try{System.Diagnostics.StackTracest=newSystem.Diagnostics.StackTrace();System.Diagnostics.StackFrame....
public static void DebugFunctionTree(string message) { try { System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace(); System.Diagnostics.StackFrame[] sfs = st.GetFrames(); StringBuilder sb = new StringBuilder(); for (int u = 1; u < sfs.Length; ++u) { System.Reflection.MethodBase mb = sfs[u].GetMethod(); string pms = string.Empty; foreach (var p in mb.GetParameters()) { pms += p.ParameterType.FullName + ":" + p.Name + ","; } sb.AppendLine(string.Format("[方法調用樹][{0}]: {1}.{2} 參數:{3}", u, mb.DeclaringType.FullName, mb.Name, pms)); } XX.General.Exception.Debug(message+"-開始"); XX.General.Exception.Debug(sb.ToString()); XX.General.Exception.Debug(message + "-結束"); } catch (Exception) { }
}