The two blocks of code you mentioned are two different things.
The first block is an automatic change of properties . This is syntactic sugar for a complete definition of properties, which is as follows:
private static bool _initialized; public static bool Initialized { private set { _initialized = value; } get { return _initialized; } }
The second block of code is the static definition of the participant . If you look at the extension that I cited above, you will notice that it includes the definition of a private static member. If you want to specify an initial value, you can do it here:
private static bool _initialized = false; public static bool Initialized { private set { _initialized = value; } get { return _initialized; } }
The built-in property definition used was designed only to make the code shorter in the most common case. If you want to do something else, you can use the full form of the property code.
Alternatively, you can go along a completely different route and use a static constructor. (See Corey's answer )
Simon P Stevens Apr 07 '10 at 22:37 2010-04-07 22:37
source share