/// <summary> /// Initializes a new instance of the <see cref="JsonBackedObjectBase" /> class. /// </summary> /// <param name="json">The json.</param> protected JsonReadOnlyListBase(JToken json) : base(json) { r_ItemsList = new LazyWithReset <IList <TItem> >(() => { var list = ItemSource != null ? new List <TItem>(ItemSource) : new List <TItem>(); return(list); }); r_ItemsDictionary = new LazyWithReset <Dictionary <string, TItem> >(() => { var dictionary = new Dictionary <string, TItem>(); if (HasKey) { foreach (var item in r_ItemsList.Value) { var key = ExtractKey(item); dictionary.Add(key, item); } } return(dictionary); }); }
/// <summary> /// Initializes static members of the <see cref="WorkItemImpl_UnitTests" /> class. /// </summary> static WorkItemImpl_UnitTests() { sr_TestInstance = new LazyWithReset <WorkItemImpl>(TestInstanceCreator); }