/// <summary> /// Initializes a new instance of the <see cref="BaseAmqpProtocol{TMessage}" /> class. /// </summary> /// <param name="serializer">binary serializer for converting messages to bytes</param> /// <param name="defaults">override for protocol defaults</param> protected BaseAmqpProtocol(IBidirectionalConverter <TMessage, ReadOnlyMemory <byte> > serializer, IAmqpProtocolDefaults defaults) { Arguments.NotNull(serializer, nameof(serializer)); Arguments.NotNull(defaults, nameof(defaults)); this.Serializer = serializer; this.defaults = defaults; }
/// <summary> /// Converts the specified items. /// </summary> /// <typeparam name="TInput">The type of the input.</typeparam> /// <typeparam name="TOutput">The type of the output.</typeparam> /// <param name="items">The items.</param> /// <param name="converter">The converter.</param> /// <returns>The converted representation of the input.</returns> public static IEnumerable <TOutput> Convert <TInput, TOutput>(this IEnumerable <TInput> items, IBidirectionalConverter <TInput, TOutput> converter) { return(converter.ConvertAll(items)); }
/// <summary> /// Initializes a new instance of the <see cref="BaseAmqpProtocol{TMessage}" /> class. /// </summary> /// <param name="serializer">binary serializer for converting messages to bytes</param> protected BaseAmqpProtocol(IBidirectionalConverter <TMessage, ReadOnlyMemory <byte> > serializer) : this(serializer, new AmqpProtocolDefaults()) { }
/// <summary> /// Converts all. /// </summary> /// <typeparam name="T1">The type of the 1.</typeparam> /// <typeparam name="T2">The type of the 2.</typeparam> /// <param name="converter">The converter.</param> /// <param name="input">The input.</param> /// <returns>The converted representation of the input.</returns> public static IEnumerable <T2> ConvertAll <T1, T2>(this IBidirectionalConverter <T1, T2> converter, IEnumerable <T1> input) { return(ConvertInternal <T1, T2>(input, converter.Convert)); }