#region Utility

 #if TRACE
private const string Traceformat = "\"{0}\",\"{1:yyyy-MM-dd HH:mm:ss.fffffff}\",\"{2}\",\"{3}\",\"{4}\"";
#endif /// <summary>
/// tarce.WriteLine前缀名,时间,成员名,文件名,行号。前缀缺省是“TC”,便于检索。
/// </summary>
/// <remarks>至少.NET Framework 4.5</remarks>
[Conditional("TRACE")]
public static void TraceCaller(
[System.Runtime.CompilerServices.CallerMemberName]
string memberName = "",
[System.Runtime.CompilerServices.CallerFilePath]
string filePath = "",
[System.Runtime.CompilerServices.CallerLineNumber]
int lineNumber = ,
string prefix = "[TC] ")
{
Trace.WriteLine(string.Format(Traceformat, prefix, DateTime.Now, memberName, filePath, lineNumber));
} #endregion
05-12 23:31