public override KeyValuePair <TKey, TValue> Load(CtpCommandReader reader) { if (reader.NodeType != CommandSchemaSymbol.StartElement) { throw new Exception("Expecting An Element Type"); } if (reader.IsElementOrArrayNull) { throw new Exception("Null is not supported"); } m_serializeT.Load(reader, out bool isNull, out TKey key, out TValue value); if (isNull) { throw new NotSupportedException(); } return(new KeyValuePair <TKey, TValue>(key, value)); }
public override TDictionary Load(CtpCommandReader reader) { if (!reader.IsArray) { throw new Exception("Expecting An Array Type"); } if (reader.IsElementOrArrayNull) { reader.Read(); return(null); } Dictionary <TKey, TValue> items = new Dictionary <TKey, TValue>(reader.ArrayCount); int x = 0; while (reader.Read()) { switch (reader.NodeType) { case CommandSchemaSymbol.StartElement: case CommandSchemaSymbol.StartArray: case CommandSchemaSymbol.Value: m_serializeT.Load(reader, out bool isNull, out TKey key, out TValue value); if (isNull) { throw new NotSupportedException(); } items[key] = value; x++; break; case CommandSchemaSymbol.EndArray: return(m_castToType(items)); default: throw new ArgumentOutOfRangeException(); } } throw new ArgumentOutOfRangeException(); }