-
Notifications
You must be signed in to change notification settings - Fork 317
Tests | ActiveIssues (Part 4) #3750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
d543a1b
cafa83b
b5dd2fe
0815d29
317f456
20f46f7
c1f9ac1
814736f
d2a7930
099bc0b
976c6fe
f17d382
9dec519
55887af
27e9f3d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,83 @@ | ||||||
| // 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; | ||||||
|
|
||||||
| #nullable enable | ||||||
|
|
||||||
| namespace Microsoft.Data.SqlClient.Tests.Common | ||||||
| { | ||||||
| /// <summary> | ||||||
| /// Utility class that enables disposal of a collection of <see cref="IDisposable"/> objects | ||||||
| /// with a single <c>using</c> statement. | ||||||
| /// </summary> | ||||||
| /// <typeparam name="T">Type of the elements contained within.</typeparam> | ||||||
| public class DisposableArray<T> : IDisposable, IEnumerable<T> | ||||||
mdaigle marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| where T : IDisposable? | ||||||
| { | ||||||
| private readonly T[] _elements; | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// Constructs a new instance with <paramref name="size"/> elements. | ||||||
| /// </summary> | ||||||
| /// <remarks> | ||||||
| /// Remember when using this constructor that the underlying array will be initialized to | ||||||
| /// <c>default(T)</c>. If <typeparamref name="T"/> is a reference type, this will be | ||||||
| /// <c>null</c> - even if <typeparamref name="T"/> is not nullable! | ||||||
| /// </remarks> | ||||||
| /// <param name="size">Number of elements the new instance will contain.</param> | ||||||
| public DisposableArray(int size) | ||||||
| { | ||||||
| _elements = new T[size]; | ||||||
| } | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// Constructs a new instance from an existing array of elements. | ||||||
| /// </summary> | ||||||
| /// <param name="elements">Array of elements to store within the current instance.</param> | ||||||
| public DisposableArray(T[] elements) | ||||||
| { | ||||||
| _elements = elements; | ||||||
| } | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// Gets or sets the element at index <see cref="i"/>. | ||||||
|
||||||
| /// Gets or sets the element at index <see cref="i"/>. | |
| /// Gets or sets the element at index <paramref name="i"/>. |
Uh oh!
There was an error while loading. Please reload this page.