public override bool Write(RCSymbolScalar key, int index, object box, bool force) { T val = (T)box; T old; // The key may be null if there is no timeline. if (_last != null && key != null) { if (!force && _last.TryGetValue(key, out old)) { if (Comparer <T> .Default.Compare(val, old) == 0) { return(false); } } _last[key] = val; } if (_index.Count == 0 || _index[_index.Count - 1] < index) { _data.Write(val); _index.Write(index); } else { // Do we need to look for this? bool found; int existing = _index.BinarySearch(index, out found); if (existing < 0) { throw new Exception("Invalid index " + index); } _data.Write(existing, val); } return(true); }