public void Add(dynamic value) { IsArray.AssertTrue(); var max_index = _complex.Keys.Select(s => int.Parse(s)).MaxOrDefault(-1); // todo. wtf dynamic ain't work here as well _complex.Add(ImportKey(max_index + 1), ImportValue((Object)value)); }
public void Insert(int index, dynamic value) { IsArray.AssertTrue(); var before = _complex.Where(kvp => int.Parse(kvp.Key) < index).ToDictionary(); // todo. wtf dynamic ain't work here as well var inserted = new KeyValuePair <String, Json>(ImportKey(index), ImportValue((Object)value)).MkArray().ToDictionary(); var after = _complex.Where(kvp => int.Parse(kvp.Key) >= index).ToDictionary(kvp => (int.Parse(kvp.Key) + 1).ToString(), kvp => kvp.Value); _complex.Clear(); _complex.AddElements(before); _complex.AddElements(inserted); _complex.AddElements(after); }
public void RemoveAt(int index) { IsArray.AssertTrue(); _complex.Remove(ImportKey(index)); }
public int IndexOf(dynamic value) { IsArray.AssertTrue(); // todo. wtf dynamic ain't work here as well return(_complex.IndexOf(kvp => Equals(kvp.Value, ImportValue((Object)value)))); }
public bool Contains(dynamic value) { IsArray.AssertTrue(); return(IndexOf(ImportValue(value)) != -1); }