-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/v3' of https://github.com/Azure/autorest.csharp …
…into getAllModels * 'feature/v3' of https://github.com/Azure/autorest.csharp: fix(dpg): same type property only mock once (#3633)
- Loading branch information
Showing
13 changed files
with
1,318 additions
and
672 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using AutoRest.CSharp.Utilities; | ||
|
||
namespace AutoRest.CSharp.Common.Utilities | ||
{ | ||
internal static class HashSetExtensions | ||
{ | ||
/// <summary> | ||
/// Push an item into the set, which will be popped later when the returned <see cref="IDisposable"/> is disposed. | ||
/// </summary> | ||
/// <typeparam name="T"><see cref="HashSet{T}">HashSet</see> item</typeparam> | ||
/// <param name="hashSet"></param> | ||
/// <param name="item">Item to push</param> | ||
/// <returns></returns> | ||
internal static IDisposable Push<T>(this HashSet<T> hashSet, T item) | ||
{ | ||
hashSet.Add(item); | ||
return Disposable.Create(() => | ||
{ | ||
hashSet.Remove(item); | ||
}); | ||
} | ||
} | ||
} |
Oops, something went wrong.