I think you need to upload your dictionary and then want to cache it. You can do it lazily in getter:
public class DataSet { private IDictionary<string, MyClass> property; public IDictionary<string, MyClass> Property { if (property == null) { property = LoadProperty(); } return property; } }
or look in the constructor:
public class DataSet { public IDictionary<string, MyClass1> Property { get; private set; } public DataSet() { Property = LoadProperty(); } }
In addition, this method makes sense:
private static Dictionary<string, MyClass1> GetProperty1Alternative(DataSet dataSet)
Instead of calling it like this:
DataSet.GetProperty1Alternative(anInstance);
you can just do this:
anIntance.Property;
source share