public Value this[Key key] { get { for (int i = 0; i < mSize; ++i) { if (mValues[i].key.Equals(key)) { return(mValues[i].value); } } return(default(Value)); } set { int index = IndexOf(key); if (index == -1) { if (mSize == mValues.Length) { EnsureCapacity(mSize + 1); } mValues[mSize] = new ScorpioValue <Key, Value>() { key = key, value = value }; ++mSize; } else { mValues[index].value = value; } } }
public void Set(ScorpioDictionary <Key, Value> value) { mSize = value.mSize; mValues = new ScorpioValue <Key, Value> [mSize]; for (var i = 0; i < mSize; ++i) { mValues[i] = new ScorpioValue <Key, Value>().Set(value.mValues[i]); } }
void SetCapacity(int value) { if (value > 0) { var array = new ScorpioValue <Key, Value> [value]; if (mSize > 0) { Array.Copy(mValues, 0, array, 0, mSize); } mValues = array; } else { mValues = _emptyArray; } }
public ScorpioValue <Key, Value> Set(ScorpioValue <Key, Value> v) { this.key = v.key; this.value = v.value; return(this); }