Skip to content

Commit

Permalink
Add documentation for CsvDataReader ctor parameter 'leaveOpen'
Browse files Browse the repository at this point in the history
  • Loading branch information
Pawel Krzyzak authored and Pawel Krzyzak committed Jan 27, 2025
1 parent f21fd46 commit e0a1be8
Showing 1 changed file with 28 additions and 27 deletions.
55 changes: 28 additions & 27 deletions src/CsvHelper/CsvDataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,13 @@ public int FieldCount
}
}

/// <summary>
/// Initializes a new instance of the <see cref="CsvDataReader"/> class.
/// </summary>
/// <param name="csv">The CSV.</param>
/// <param name="schemaTable">The DataTable representing the file schema.</param>
public CsvDataReader(CsvReader csv, DataTable? schemaTable = null, bool leaveOpen = false)
/// <summary>
/// Initializes a new instance of the <see cref="CsvDataReader"/> class.
/// </summary>
/// <param name="csv">The CSV.</param>
/// <param name="schemaTable">The DataTable representing the file schema.</param>
/// <param name="leaveOpen"><c>true</c> to leave the <see cref="CsvReader"/> open after the <see cref="CsvDataReader"/> object is disposed, otherwise <c>false</c>.</param>
public CsvDataReader(CsvReader csv, DataTable? schemaTable = null, bool leaveOpen = false)
{
this.csv = csv;
this.leaveOpen = leaveOpen;
Expand All @@ -97,35 +98,35 @@ public void Close()
Dispose();
}

/// <inheritdoc/>
public void Dispose()
/// <inheritdoc/>
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}

/// <summary>
/// Disposes the object.
/// </summary>
/// <param name="disposing">Indicates if the object is being disposed.</param>
protected virtual void Dispose(bool disposing)
{
if (disposed)
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
return;
}

/// <summary>
/// Disposes the object.
/// </summary>
/// <param name="disposing">Indicates if the object is being disposed.</param>
protected virtual void Dispose(bool disposing)
if (disposing)
{
if (disposed)
{
return;
}

if (disposing)
if (!leaveOpen)
{
if (!leaveOpen)
{
csv?.Dispose();
}
csv?.Dispose();
}

disposed = true;
}

disposed = true;
}

/// <inheritdoc />
public bool GetBoolean(int i)
{
Expand Down

0 comments on commit e0a1be8

Please sign in to comment.