public void WriteValue(IValueWriter valueWriter, T value) { if (value == null) { valueWriter.DirectWrite(null); return; } var dictionaryRW = new DictionaryRW <T, TKey, TValue>(); dictionaryRW.Initialize(value); if (typeof(TKey) == typeof(string)) { valueWriter.WriteObject(Unsafe.As <IDataReader <string> >(dictionaryRW)); } else { if (valueWriter is IMapValueWriter mapWriter) { mapWriter.WriteMap(dictionaryRW); } else { valueWriter.WriteObject(dictionaryRW.As <string>()); } } }
public void WriteValue(IValueWriter valueWriter, T value) { if (value == null) { valueWriter.DirectWrite(null); return; } var dictionaryRW = new DictionaryRW <T, TKey, TValue>(); dictionaryRW.Initialize(value); valueWriter.WriteObject(((IDataReader)dictionaryRW).As <string>()); }
public void WriteValue(IValueWriter valueWriter, T value) { if (value == null) { valueWriter.DirectWrite(null); return; } var dictionaryRW = new DictionaryRW <T>(); dictionaryRW.Initialize(value); if (valueWriter is IMapValueWriter mapWriter) { mapWriter.WriteMap(dictionaryRW); } else { valueWriter.WriteObject(dictionaryRW.As <string>()); } }
public void WriteValue(IValueWriter valueWriter, T value) { if (value == null) { valueWriter.DirectWrite(null); return; } var dictionaryRW = new DictionaryRW <T, TKey, TValue>(); dictionaryRW.Initialize(value); if (IsArray) { valueWriter.WriteArray(dictionaryRW.As <int>()); } else { valueWriter.WriteObject(dictionaryRW.As <string>()); } }