Frank, (Sorry, I'm way late with this reply... I took a few days off and actually enjoyed other things than coding and thinking about it... ;))
On Thu, 6 Jun 2002 08:06:13 -0700, Frank Hileman <[EMAIL PROTECTED]> wrote: >Regarding static var for singleton: I found that static vars are not >initialized until the first time you use the class. If you don't use the >class, they are never initialized. So your one argument against using a >static var is refuted. As another poster pointed out, your code is not >thread-safe. In the end, the simplest and best approach is the static var. >There was an article about the singleton pattern in C# (in MSDN I think), >and it came to exactly the same conclusion. I think some postings in this thread showed us how to get the code thread safe... The main issue is: I really feel bad about public fields, whether they are static or non-static... I think that we've been using accessor methods and -- now -- properties for all those reasons. So why would we throw away that now? --Stefan You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.