public byte[] Serialize(IDistributedPropertySet data) { var targetData = new Dictionary <string, KeyValuePair <string, object> >(); data.ToList().ForEach(pair => targetData.Add(pair.Key, new KeyValuePair <string, object>(pair.Value.GetType().FullName, pair.Value))); return(JsonSerializer.SerializeToUtf8Bytes(targetData, Options)); }
public byte[] Serialize(IDistributedPropertySet data) { var targetData = new Dictionary <string, Pair>(); data.ToList().ForEach(pair => targetData.Add(pair.Key, new Pair { Key = pair.Value.GetType().FullName, Value = pair.Value })); var sb = new StringBuilder(); using var textWriter = new StringWriter(sb); new Serializer().Serialize(textWriter, targetData); return(Encoding.UTF8.GetBytes(sb.ToString())); }