using System;
namespace TBL.CSharp.Base
{
public static partial class Extension
{
#if DEBUG
///
/// 获取调用时的源代码行数
///
public static int SourceLineNumber([System.Runtime.CompilerServices.CallerLineNumber] int lineNumber = 0)
{
return lineNumber;
}
///
/// 获取调用时的文件路径
///
public static string SourceFilePath([System.Runtime.CompilerServices.CallerFilePath] string fileName = "")
{
return fileName;
}
///
/// 源文件名变为生成源码文件名
///
public static string SourceFileGeneratePath(string path)
{
var pi = path.LastIndexOf(".cs", StringComparison.Ordinal);
if (pi >= 0)
{
return $"{path.Substring(0, pi)}.Generated.cs";
}
return $"{path}.Generated";
}
#endif
}
}