I tried to implement a singleton class in the following way (I use VS2008 SP1) :
namespace firstNamespace
{
class SingletonClass
{
private SingletonClass() {}
public static readonly SingletonClass Instance = new SingletonClass();
}
}
When I want to access it from a class in a different namespace (it seems that this is the problem, in the same namespace it works) like :
namespace secondNamespace
{
...
firstNamespace.SingletonClass inst = firstNamespace.SingletonClass.Instance;
...
}
I get a compiler error:
error CS0122: 'firstNamespace.SingletonClass' is inaccessible due to its protection level
Does somebody have an idea how to solve this?
Many thanks in advance!