Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static readonly SingletonClass instance = new SingletonClass();
- public static SingletonClass Instance
- {
- get
- {
- return instance;
- }
- }
- private static SingletonClass instance;
- public static GetInstance
- {
- get
- {
- if(instance == null)
- {
- instance = new SingletonClass();
- }
- return instance;
- }
- }
- public class MyClass
- {
- private DataTable _dt;
- public DataTable GetDt
- {
- get
- {
- if (_dt == null)
- {
- _dt = new DataTable();
- _dt.Columns.Add("Column1", typeof(string));
- _dt.Columns.Add("Column2", typeof(string));
- _dt.Rows.Add(new string[] { "cell1", "cell2" });
- }
- return _dt;
- }
- }
- }
Add Comment
Please, Sign In to add comment