SoftPilot.2000 Software Outsourcing Ukraine. Software Development. Design Patterns. Creational Patterns. Singleton. C#. dotNet. SoftPilot.2000 Software Outsourcing Ukraine. Software Development. Design Patterns. Creational Patterns. Singleton. C#. dotNet.
SoftPilot.2000 Software Outsourcing Ukraine. Software Development. Design Patterns. Creational Patterns. Singleton. C#. dotNet.
SoftPilot.2000 Software Outsourcing Ukraine. Software Development. Design Patterns. Creational Patterns. Singleton. C#. dotNet.
SoftPilot.2000 Software Outsourcing Ukraine. Software Development. Design Patterns. Creational Patterns. Singleton. C#. dotNet.
softPilot.2000 : Software Outsourcing from Ukraine - Site Map SoftPilot.2000 Software Outsourcing Ukraine. Software Development. Design Patterns. Creational Patterns. Singleton. C#. dotNet.
SoftPilot.2000 - Software Outsourcing Ukraine. Software Development. Design Patterns. Creational Patterns. Singleton. C#. dotNet. SoftPilot.2000 - Software Outsourcing Ukraine. Software Development. Design Patterns. Creational Patterns. Singleton. C#. dotNet. SoftPilot.2000 - Software Outsourcing Ukraine. Software Development. Design Patterns. Creational Patterns. Singleton. C#. dotNet. SoftPilot.2000 - Software Outsourcing Ukraine. Software Development. Design Patterns. Creational Patterns. Singleton. C#. dotNet. SoftPilot.2000 - Software Outsourcing Ukraine. Software Development. Design Patterns. Creational Patterns. Singleton. C#. dotNet. SoftPilot.2000 - Software Outsourcing Ukraine. Software Development. Design Patterns. Creational Patterns. Singleton. C#. dotNet. SoftPilot.2000 - Software Outsourcing Ukraine. Software Development. Design Patterns. Creational Patterns. Singleton. C#. dotNet.
SoftPilot.2000 : Software Outsourcing Ukraine- Home SoftPilot.2000 : Software Outsourcing Ukraine - About SoftPilot.2000 : Software Outsourcing Ukraine - Company Profile SoftPilot.2000 : Software Outsourcing Ukraine - Case Study SoftPilot.2000 : Software Outsourcing Ukraine - Services SoftPilot.2000 : Software Outsourcing Ukraine - Partners SoftPilot.2000 : Software Outsourcing Ukraine - Contacts SoftPilot.2000 : Software Outsourcing Ukraine - E-mail SoftPilot.2000 : Software Outsourcing to Ukraine

SoftPilot.2000 - Software Outsourcing from Ukraine.

The number of software development articles about design patterns implementation in C#.

Creational Patterns.




Singleton.

During application development process a developer in many cases needs to be sure that some class has only one (single) instantiated object during application lifecycle. In that way the singleton pattern is the standard solution.

Singleton is one of the easiest desgn pattern and the implementation is the obvious. The main trick in the singleton implementation is to hide the class constructor as the protected method as well as the method for class instantiation needs to be declared as the static. This way is one of the popular singleton pattern implementation methods.

 

 

 

  SoftPilot.2000 Outsourcing Services - Design Patterns implementation in C#. Singleton.
Singleton Pattern, C# implementation:

//Singleton design pattern implementation in C#

//------------------------------------
// The Singleton Class Implementation

using System;

class MySingletonClass
{
  private static MySingletonClass m_instance = null;
  private static bool m_isInstantiated = false;

private MySingletonClass()
{
}

public static MySingletonClass GetInstance()
{
  if (!m_isInstantiated)
  {
    m_instance = new MySingletonClass();
    m_isInstantiated = true;
    return m_instance;
  }
  else
    return m_instance;
}

protected void Finalize()
{
  m_isInstantiated = false;
}

//------------------------------------------
// The client class implementation

Class MyApplicationClass
{
  public static void Main()
{

  MySingletonClass ms;
  ms = MySingletonClass.GetInstance();

}
}



 
   
(C) SoftPilot.2000 All Rights Reserved. 2000 - 2006