c# 4.5以上通过CallerFilePath获取调用所在类 public void LogHelpers([CallerFilePath] string propertyName = "") { this.name = name; }