public Enumerator(InlineDictionary <TKey, TValue> parent) { _arr = null; _first = default; _index = -1; _inner = default; if (parent._data is Dictionary <TKey, TValue> inner) { _inner = inner.GetEnumerator(); _type = Type.Dictionary; } else if (parent._data is KeyValuePair <TKey?, TValue?>[] arr) { _type = Type.Array; _arr = arr; } else if (parent._data != null) { _type = Type.Single; _first = new((TKey)parent._data !, parent._value !); } else { _type = Type.Empty; } }
private void SerializeInlineDictionary(List<string> output, InlineDictionary dictionary) { output.Add("{"); for (int i = 0; i < dictionary.Keys.Length; ++i) { if (i > 0) output.Add(", "); SerializeExpression(output, dictionary.Keys[i]); output.Add(": "); SerializeExpression(output, dictionary.Values[i]); } output.Add("}"); }