Assigning to static readonly field of base class
问题 public class ClassA { public static readonly string processName; } public class ClassB : ClassA { static ClassB() { processName = "MyProcess.exe"; } } I am getting an error while compiling the above C# code. The error says -- "A static readonly field cannot be assigned to (except in a static constructor or a variable initializer)" But I am assigning it in a static constructor. The need for such a static variable is that, the base class has methods that uses this variable, but the derived