public void Remove(NewClass obj) { ByName.Remove(obj.Name); ByScore[obj.Score].Remove(obj); ByPosition[obj.Pos].Remove(obj); objects.Remove(obj); }
public void RemoveByName(string name) { if (!ByName.ContainsKey(name)) { return; } NewClass obj = ByName[name]; Remove(obj); }
public void Add(NewClass obj) { int score = obj.Score; if (ByScore.ContainsKey(score)) { ByScore[score].Add(obj); } else { ByScore.Add(score, new HashSet <NewClass>() { obj }); } Position pos = obj.Pos; if (ByPosition.ContainsKey(pos)) { ByPosition[pos].Add(obj); } else { ByPosition.Add(pos, new HashSet <NewClass>() { obj }); } ByName.Add(obj.Name, obj); obj.Node = objects.AddFirst(obj); }