/// <summary> /// Helper method to serialize list contents. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="list"></param> /// <param name="msg"></param> /// <param name="serializer"></param> /// <param name="kind"></param> /// <param name="ordinal"></param> protected static void SerializeList <T>(IEnumerable <T> list, IAppendingFudgeFieldContainer msg, IFudgeSerializer serializer, TypeData.TypeKind kind, int?ordinal) { switch (kind) { case TypeData.TypeKind.FudgePrimitive: case TypeData.TypeKind.Reference: msg.AddAll(null, ordinal, list); break; case TypeData.TypeKind.Inline: serializer.WriteAllInline(msg, null, ordinal, list); break; } }
/// <summary> /// Serializes all the values as a sequence of submessages with the same field name. /// </summary> /// <typeparam name="T">Type of objects.</typeparam> /// <param name="serializer">Serializer to write the fields.</param> /// <param name="msg">Parent message for the sub-message.</param> /// <param name="name">Name of the fields.</param> /// <param name="objects">Objects to serialize.</param> /// <remarks>See the remarks in <see cref="WriteInline"/> regarding the limitations of writing as an in-line sub-message.</remarks> /// <remarks><c>null</c>s in the sequence are written as Fudge <see cref="IndicatorType"/>s.</remarks> public static void WriteAllInline <T>(this IFudgeSerializer serializer, IAppendingFudgeFieldContainer msg, string name, IEnumerable <T> objects) { serializer.WriteAllInline(msg, name, null, objects); }