What is Private Constructor ?


A private constructor is used in classes that contain static members only. Other classes (except nested classes) can not create instances of this private class.
Example

public class Counter
{
    private Counter() { }
    public static int iCount;
    public static int IncrementCount()
    {
        return ++iCount;
    }
}

class TestCounter
{
    static void Main()
    {
        // If you uncomment the following statement, it will generate 
        // an error because the constructor is inaccessible: 
        // Counter aCounter = new Counter();   // Error

        Counter.iCount= 100;
        Counter.IncrementCount();
        Console.WriteLine("New count: {0}", Counter.iCount);
    }
}
// Output: New count: 101