public override void GenerateSerializer(StreamWriter writer, string callName) { var itemCallName = callName + "_ITEM"; writer.Write($@" public static void {callName}(JsonFormatter f, {m_inner.ValueType.Name}[] value) {{ f.BeginList(); foreach(var item in value) {{ " ); writer.Write($"{m_inner.GenerateSerializerCall(itemCallName, "item")};\n"); writer.Write(@" } f.EndList(); } "); if (!m_inner.IsInline) { m_inner.GenerateSerializer(writer, itemCallName); } }
public override void GenerateSerializer(StreamWriter writer, string callName) { var itemCallName = callName + "_ITEM"; writer.Write($@" public static void {callName}(JsonFormatter f, Dictionary<string, {m_inner.ValueType.Name}> value) {{ f.BeginMap(); foreach(var kv in value) {{ f.Key(kv.Key); {m_inner.GenerateSerializerCall(itemCallName, "kv.Value")}; }} f.EndMap(); }} "); if (!m_inner.IsInline) { m_inner.GenerateSerializer(writer, itemCallName); } }