public override void Serialize(HessianOutput output, object map, string customTypeName) { var typeName = customTypeName ?? _type.FullName; var defIdx = output.WriteMapDefinition(typeName, _fieldNames); if (defIdx < 0) { output.WriteMapStart(typeName); for (int i = 0; i < _fields.Length; i++) { output.WriteString(_fieldNames[i]); _fieldSerializers[i].WriteField(output, map); } output.WriteMapEnd(); } else { output.WriteMapStart(defIdx); for (int i = 0; i < _fields.Length; i++) { _fieldSerializers[i].WriteField(output, map); } } }
public override void Serialize(HessianOutput output, object map, string customTypeName) { var typeName = customTypeName ?? _type.FullName; output.WriteMapStart(typeName); // entries foreach (var fieldInfo in _fields) { output.WriteString(fieldInfo.Name); output.WriteObject(fieldInfo.GetValue(map)); } output.WriteMapEnd(); }
public override void Serialize(HessianOutput output, object map, string customTypeName) { var dict = (IDictionary)map; var typeName = customTypeName; output.WriteMapStart(typeName); foreach (var key in dict.Keys) { output.WriteObject(key); output.WriteObject(dict[key]); } output.WriteMapEnd(); }
public override void Serialize(HessianOutput output, object map, string customTypeName) { var typeName = customTypeName ?? _type.FullName; var value = Enum.GetName(_type, map); var defIdx = output.WriteMapDefinition(typeName, _fieldNames); if (defIdx < 0) { output.WriteMapStart(typeName); output.WriteString("name"); output.WriteString(value); output.WriteMapEnd(); } else { output.WriteMapStart(defIdx); output.WriteString(value); } }