public TBuilder AppendRange(IEnumerable <byte> values) { var len = ValueBuffer.Length; ValueOffsets.Append(Offset); ValueBuffer.AppendRange(values); Offset += ValueBuffer.Length - len; return(Instance); }
public TBuilder AppendRange(IEnumerable <byte> values) { if (values == null) { return(AppendNull()); } int len = ValueBuffer.Length; ValueBuffer.AppendRange(values); int valOffset = ValueBuffer.Length - len; ValueOffsets.Append(Offset); Offset += valOffset; ValidityBuffer.Append(true); return(Instance); }
/// <summary> /// Append a value, consisting of an enumerable collection of bytes, to the array. /// </summary> /// <remarks> /// Note that this method appends a single value, which may consist of arbitrarily many bytes. If multiple /// values are to be added, use the <see cref="AppendRange(IEnumerable{byte})"/> method instead. /// </remarks> /// <param name="value">Enumerable collection of bytes to add.</param> /// <returns>Returns the builder (for fluent-style composition).</returns> public TBuilder Append(IEnumerable <byte> value) { if (value == null) { return(AppendNull()); } // Note: by looking at the length of the value buffer before and after, we avoid having to iterate // through the enumerable multiple times to get both length and contents. int priorLength = ValueBuffer.Length; ValueBuffer.AppendRange(value); int valueLength = ValueBuffer.Length - priorLength; Offset += valueLength; ValidityBuffer.Append(true); ValueOffsets.Append(Offset); return(Instance); }