2

What classes in the .NET Platform use the Singleton pattern?

Just want to take a look at them through Reflector and see how are implemented, and more than it, how Singleton can be used in different contexts.

Oscar Mederos
  • 29,016
  • 22
  • 84
  • 124

3 Answers3

2

Pretty much where you see Provider in the name. Especially in the FormsAuthenication and Membership parts of ASP.NET.

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
1

System.DBNull:

public sealed class DBNull 
{
   public static readonly DBNull Value;

   static DBNull()
   {
      Value = new DBNull();
   }

   private DBNull() {}
}
Mark Cidade
  • 98,437
  • 31
  • 224
  • 236
1

Definitely the Settings classes which derive from System.Configuration.ApplicationSettingsBase. Pretty much all the application/user scope settings are managed by singleton instances.

Teoman Soygul
  • 25,584
  • 6
  • 69
  • 80