You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The behavior you are seeing is expected. Your first example has "before field init" constructor that is not guaranteed to run. The runtime can choose whether to run it or not, and the behavior can differ between debug and release builds.
Here is an example of the behavior I get :
public class MyClass
{
private static readonly MyClass _instance = new MyClass();
}
public class MyClass
{
private static readonly MyClass _instance;
}
The text was updated successfully, but these errors were encountered: