/// <summary> /// Determines whether this record is equal to another. /// </summary> /// <remarks> /// Records are considered equal if they have the same number of values, and every corresponding value is equal. /// </remarks> /// <param name="other"> /// The other record. /// </param> /// <returns> /// <see langword="true"/> if the records are equal, otherwise <see langword="false"/>. /// </returns> public bool Equals(RecordBase other) { if (other == null) { return(false); } if (object.ReferenceEquals(other, this)) { return(true); } if (values.Count != other.values.Count) { return(false); } for (var i = 0; i < values.Count; ++i) { if (!string.Equals(values[i], other.values[i], StringComparison.CurrentCulture)) { return(false); } } return(true); }
/// <summary> /// Writes a record to this <c>CsvWriter</c>. /// </summary> /// <remarks> /// All values within <paramref name="record"/> are written in the order they appear. /// </remarks> /// <param name="record"> /// The record to write. /// </param> public void WriteRecord(RecordBase record) { Debug.Assert(this.bufferBuilder.Length == 0, "Expecting buffer to be empty."); this.EnsureNotDisposed(); //record.AssertNotNull("record"); this.WriteRecordToBuffer(record); this.FlushBufferToTextWriter(); }
/// <summary> /// Asynchronously writes a record to this <c>CsvWriter</c>. /// </summary> /// <remarks> /// All values within <paramref name="record"/> are written in the order they appear. /// </remarks> /// <param name="record"> /// The record to write. /// </param> /// <returns> /// A <see cref="Task"/> representing the asynchronous operation. /// </returns> public async Task WriteRecordAsync(RecordBase record) { Debug.Assert(this.bufferBuilder.Length == 0, "Expecting buffer to be empty."); this.EnsureNotDisposed(); record.AssertNotNull("record"); this.WriteRecordToBuffer(record); await this.FlushBufferToTextWriterAsync().ConfigureAwait(false); }