On Tue, 2005-02-22 at 09:41 +0800, Troy Laurin wrote: > > [DCL] > > > >On .NET the code above just works fine. What's important is to define > >resourceManager as following: > > > >private static volatile ResourceManager resourceManager; > > > >Honestly, the only thing I forgot in the original source code was > >the "volatile" keyword. > > Fair enough. I'd believe this would work with the volatile keyword. > > Just as a note though, using a readonly static-initialised member > that's non-volatile is still correct but should be more performant... > since reads of a volatile reference can't be cached, they will always > go to main memory.
Would you suggest something like this? sealed class ResourceUtils { private ResourceUtils() {} public static readonly ResourceUtils Instance = new ResourceUtils(); ... } ... string errorMessage = ResourceUtils.Instance.GetString("NA1001"); That works fine too, but looking at http://msdn.microsoft.com/library/default.asp?url=/library/en- us/dnbda/html/singletondespatt.asp, on .NET the result is exactly the same as with the double-checked locking pattern > > I guess I've been a Java programmer too long... the double-checked > locking pattern just looks wrong to my eyes. Oh no! Java? Pfui!!! I come from C/C++... and my bibles were "Effective C++" and "More Effective C++" by Scott Meyers... j3d. > > Be well, > > -- Troy > -- ---------------------------------------- Giuseppe Greco ::agamura:: phone: +41 (0)91 604 67 65 mobile: +41 (0)79 602 99 27 email: [EMAIL PROTECTED] web: www.agamura.com ---------------------------------------- ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ nant-developers mailing list nant-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-developers