public void Insert() { foreach (var doc in Helper.GetDocs(_count)) { var v = new TestDoc { id = doc["_id"].AsInt32, name = doc["name"].AsString, lorem = doc["lorem"].AsString }; dict.TryAdd(v.id, v); } }
public IEnumerable <TestDoc> MakeDoc() { foreach (var doc in Helper.GetDocs(_count)) { var v = new TestDoc { id = doc["_id"].AsInt32, name = doc["name"].AsString, lorem = doc["lorem"].AsString }; yield return(v); } }
public void Insert() { var builder = ImmutableDictionary.CreateBuilder <int, TestDoc>(); foreach (var doc in Helper.GetDocs(_count)) { var v = new TestDoc { id = doc["_id"].AsInt32, name = doc["name"].AsString, lorem = doc["lorem"].AsString }; builder.Add(v.id, v); } dict = builder.ToImmutableDictionary(); }