10
I recently read that singleton is an anti-pattern and should not be used unless it is really needed.
In all our projects, we use the singleton pattern to hold some cache data. For example:
class SomeClass
{
public SomeClass()
{
var somedata = Singleton.Instance.GetSomeData(stringRepresintation); // or like that
var someData = Singleton.Instance.SomeData;
}
}
What is the recommended design to hold that data (static class, or something else)?