If I have a type like this:
public struct Effect
{
public int Value { get; set; }
public static int MinValue = Int32.MinValue;
}
Would MinValue be initialized only ONCE, just like the execution of a static constructor? Or should I initialize MinValue inside a static constructor?
Would this be any different for classes?
Yes, it would initialize exactly once, before static constructor execution. Same for reference types (classes).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With