Hi,
I have created a Singleton class to provide some database functionality in
my mobile application. I have a public class called Utility which performs
various operations on data. Is it ok to use the utility class in my Singleton
class? Here is some code to hopefully make it clearer what i want to do -
namespace MyApp
{
class SingletonConnection
{
private volatile static SingletonConnection instance;
private Utility utility;
private SingletonConnection()
{
}
public static SingletonConnection GetInstance()
{
if (instance == null)
{
instance = new SingletonConnection();
}
return instance;
}
public void DoStuff()
{
utility = new Utility();
utility.DoStuff();
}
}
class Utility
{
public Utility()
{
}
public void DoStuff()
{
}
}
}
Thanks for any tips,
Dav