<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />

SqlErrorCollection

public sealed class SqlErrorCollection : ICollection, IEnumerable
Collects all errors generated by the .NET Framework Data Provider for SQL Server. This class cannot be inherited.
public int Count { get; }

Gets the number of errors in the collection.

public SqlError this[int index] { get; }

Gets the error at the specified index.

public void CopyTo(Array array, int index)

Copies the elements of the SqlErrorCollection collection into an Array, starting at the specified index.

public void CopyTo(SqlError[] array, int index)

Copies the elements of the SqlErrorCollection collection into a SqlErrorCollection, starting at the specified index.

Returns an enumerator that iterates through the SqlErrorCollection.