>>private List<MerchantLocationModel> _Locations = null; >>public List<MerchantLocationModel> Locations >>{ >> get >> { >> if (_Locations == null) >> { >> TDCDataProvider provider = new TDCDataProvider(); >> _Locations = provider.GetMerchantLocations(RecordId); >> } >> >> return _Locations; >> } >> set >> { >> if (value != _Locations) >> { >> _Locations = value; >> RaisePropertyChanged("Locations"); >> } >> } >>}>>
public class Something > { > private Lazy<List<MerchantLocationModel>> locations; > > public Something() > { > locations = new Lazy<List<MerchantLocationModel>>( > () => { return GetList(); } > ); > } > > public List<MerchantLocationModel> Locations > { > get { return locations.Value; } > } > > public List<MerchantLocationModel> GetList() > { > TDCDataProvider provider = new TDCDataProvider(); > return provider.GetMerchantLocations(RecordId); > } > }