为什么静态构造函数在引用另一个类中的const字符串时抛出异常.
class MyClass
{
static MyClass()
{
ExamineLog();
}
static ExamineLog()
{
FilePath = HttpContext.Current.Server.MapPath(Helper.LogConfiguration);
}
}
class Helper
{
public const string LogConfiguration= "\rootpath\counters.txt";
}
Run Code Online (Sandbox Code Playgroud)
抛出的异常是未将对象引用设置为对象的实例.堆栈跟踪指向尝试读取常量值的行.有什么想法吗?