public void SetToArray(object key, int size)
{
if (key is int && m_cd.Type == ValueType.Array)
{
IronJSONValue arr = new IronJSONValue(ValueType.Array);
// Set every element to null.
for (int i = 0; i < size; ++i)
arr.Array.Add(new IronJSONValue(ValueType.Null));
m_cd.Array[(int)key] = arr;
}
else if (key is string && m_cd.Type == ValueType.Object)
{
IronJSONValue arr = new IronJSONValue(ValueType.Array);
// Set every element to null.
for (int i = 0; i < size; ++i)
arr.Array.Add(new IronJSONValue(ValueType.Null));
m_cd.Obj[(string)key] = arr;
}
else
throw new InvalidKeyException(key.ToString());
}