Q:

An inherited singleton class from a base class that takes parameters in its constructor?

public class BaseFoo
{
    private string param;

    public BaseFoo(string param)
    {
        this.param = param;
    }
}

public sealed class SingletonFoo : BaseFoo
{
    static readonly SingletonFoo instance = new SingletonFoo();

    static SingletonFoo()
    {
    }

    public static SingletonFoo Instance
    {
        get
        {
            return instance;
        }
    }
}

Is this kind of inheritance possible, where the base class requires a constructor with parameters? (The above code won't obviously compile because no parameter is passed to the base class.)
If yes, how is it accomplished?

A:

You need to make an instance constructor, and then refer to it:
public sealed class SingletonFoo : BaseFoo
{
    static readonly SingletonFoo instance = new SingletonFoo("Some Value");

    static SingletonFoo()
    {
    }

    private SingletonFoo(string value) : base(value)
    {
    }
    // ...

This will let you declare the parameter in the inline constructor, and call it down the chain.

