Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlDataAdapter.cs">
<Link>Microsoft\Data\SqlClient\SqlDataAdapter.cs</Link>
</Compile>
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlErrorCollection.cs">
<Link>Microsoft\Data\SqlClient\SqlErrorCollection.cs</Link>
</Compile>
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlInfoMessageEventHandler.cs">
<Link>Microsoft\Data\SqlClient\SqlInfoMessageEventHandler.cs</Link>
</Compile>
Expand Down Expand Up @@ -522,7 +525,6 @@
<Compile Include="Microsoft\Data\SqlClient\SqlDelegatedTransaction.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlEnums.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlError.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlErrorCollection.cs" />
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlEnclaveSession.cs">
<Link>Microsoft\Data\SqlClient\SqlEnclaveSession.cs</Link>
</Compile>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlEnclaveSession.cs">
<Link>Microsoft\Data\SqlClient\SqlEnclaveSession.cs</Link>
</Compile>
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlErrorCollection.cs">
<Link>Microsoft\Data\SqlClient\SqlErrorCollection.cs</Link>
</Compile>
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlInfoMessageEventHandler.cs">
<Link>Microsoft\Data\SqlClient\SqlInfoMessageEventHandler.cs</Link>
</Compile>
Expand Down Expand Up @@ -503,7 +506,6 @@
<Compile Include="Microsoft\Data\SqlClient\SqlDependencyUtils.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlEnums.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlError.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlErrorCollection.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlException.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlInfoMessageEvent.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlInternalConnection.cs" />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;

namespace Microsoft.Data.SqlClient
{
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlErrorCollection.xml' path='docs/members[@name="SqlErrorCollection"]/SqlErrorCollection/*' />
[Serializable, ListBindable(false)]
public sealed class SqlErrorCollection : ICollection
{
// Ideally this would be typed as List<SqlError>, but that would make the non-generic
// CopyTo behave differently than the full framework (which uses ArrayList), throwing
// ArgumentException instead of the expected InvalidCastException for incompatible types.
// Instead, we use List<object>, which makes the non-generic CopyTo behave like
// ArrayList.CopyTo.
private readonly List<object> _errors = new List<object>();

internal SqlErrorCollection() { }

/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlErrorCollection.xml' path='docs/members[@name="SqlErrorCollection"]/CopyToArrayIndex1/*' />
public void CopyTo(Array array, int index) => ((ICollection)_errors).CopyTo(array, index);

/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlErrorCollection.xml' path='docs/members[@name="SqlErrorCollection"]/CopyToArrayIndex2/*' />
public void CopyTo(SqlError[] array, int index) => _errors.CopyTo(array, index);

/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlErrorCollection.xml' path='docs/members[@name="SqlErrorCollection"]/Count/*' />
public int Count => _errors.Count;

/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlErrorCollection.xml' path='docs/members[@name="SqlErrorCollection"]/System.Collections.ICollection.SyncRoot/*' />
// MDAC 68481
object ICollection.SyncRoot => this;

/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlErrorCollection.xml' path='docs/members[@name="SqlErrorCollection"]/System.Collections.ICollection.IsSynchronized/*' />
// MDAC 68481
bool ICollection.IsSynchronized => false;

/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlErrorCollection.xml' path='docs/members[@name="SqlErrorCollection"]/Item/*' />
public SqlError this[int index] => (SqlError)_errors[index];

/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlErrorCollection.xml' path='docs/members[@name="SqlErrorCollection"]/GetEnumerator/*' />
public IEnumerator GetEnumerator() => _errors.GetEnumerator();

internal void Add(SqlError error) => _errors.Add(error);
}
}