-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/OAI-3-1
Signed-off-by: Vincent Biret <[email protected]>
- Loading branch information
Showing
14 changed files
with
1,058 additions
and
133 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,29 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace Kiota.Builder.Extensions; | ||
|
||
public static class IListExtensions | ||
{ | ||
/// <summary> | ||
/// Returns the only element of this list when it has count of exactly <c>1</c> | ||
/// </summary> | ||
/// <typeparam name="T">The contained item type.</typeparam> | ||
/// <param name="items">The items.</param> | ||
/// <returns>The only element or null.</returns> | ||
internal static T? OnlyOneOrDefault<T>(this IList<T> items) => | ||
items.Count == 1 ? items[0] : default; | ||
|
||
/// <summary> | ||
/// Adds the provided <paramref name="values"/> to this list. | ||
/// </summary> | ||
/// <typeparam name="T">The contained item type.</typeparam> | ||
/// <param name="items">The items.</param> | ||
/// <param name="values">The values to add.</param> | ||
internal static void AddRange<T>(this IList<T> items, IEnumerable<T> values) | ||
{ | ||
foreach (var item in values) | ||
{ | ||
items.Add(item); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.