Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2007

Tip: Looking for answers? Try searching our database.

Perfect Singleton with Semaphore?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
lucius - 10 Jul 2007 16:59 GMT
Can anyone show a code sample of a "perfect Singleton" that uses the
Semaphore class in Framework 2.0? I have a security-related class that
I would like to code as a Singleton, and re-use it in both ASP.NET and
WinForms. I understand that these are very differnet environments when
it comes to threading and etc, so any/all help is appreciated.

Thanks.
Michael Nemtsev - 10 Jul 2007 19:25 GMT
Hello lucius,

See there http://www.codeproject.com/dotnet/remotingsingleton.asp

---
WBR,  Michael  Nemtsev [.NET/C# MVP].  
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

l> Can anyone show a code sample of a "perfect Singleton" that uses the
l> Semaphore class in Framework 2.0? I have a security-related class
l> that I would like to code as a Singleton, and re-use it in both
l> ASP.NET and WinForms. I understand that these are very differnet
l> environments when it comes to threading and etc, so any/all help is
l> appreciated.
l>
l> Thanks.
l>
Steven Cheng[MSFT] - 11 Jul 2007 05:22 GMT
Hi Lucius,

For implementing singleton Pattern and mutlti-threading awared issue, Here
is a article from MSDN:

#Exploring the Singleton Design Pattern
http://msdn2.microsoft.com/en-us/library/ms954629.aspx

Also, for making singleton thread-safe(in multi-threading context), you can
find many web articles discussing on this:

http://en.csharp-online.net/Singleton_design_pattern:_Thread-safe_Singleton

http://aspadvice.com/blogs/oliviers_net_blog/archive/2006/07/25/Thread-safe-
singleton-pattern-with-C_23003A00_-easy_2100_.aspx

http://bloggingabout.net/blogs/rick/archive/2005/09/21/9494.aspx

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
   

This posting is provided "AS IS" with no warranties, and confers no rights.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.