I often come against the dilemma of making either a singleton or a static class for storing my app's runtime data.
Let's say
public static class DataManager
{
public static int a = 0;
public static int b = 0;
public static int c = 0;
}
Which allows me to call just DataManager.a
and
public class DataManager
{
private static DataManager _sharedInstance = new DataManager();
static internal DataManager SharedInstance()
{
return _sharedInstance;
}
public int a = 0;
public int b = 0;
public int c = 0;
}
In this call I'll have to call DataManager.SharedInstance().a
Both ways will work. But I'd like to know which is better for my app's memory and performance. Assuming that my data is big and includes many other collections.
Thanks in advance.