-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from microsoft/feature/downgradeRuntime
Changes target runtime to netstandard2.0
- Loading branch information
Showing
9 changed files
with
57 additions
and
6 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
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,42 @@ | ||
// ------------------------------------------------------------------------------ | ||
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. | ||
// ------------------------------------------------------------------------------ | ||
|
||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.Kiota.Abstractions.Extensions | ||
{ | ||
/// <summary> | ||
/// Extension methods for the <see cref="IDictionary"/> | ||
/// </summary> | ||
public static class IDictionaryExtensions | ||
{ | ||
/// <summary> | ||
/// Try to add the element to the <see cref="IDictionary"/> instance. | ||
/// </summary> | ||
/// <typeparam name="TKey"> The type of the key</typeparam> | ||
/// <typeparam name="TValue">The type of the value</typeparam> | ||
/// <param name="dictionary">The dictionary to add to.</param> | ||
/// <param name="key">The key parameter.</param> | ||
/// <param name="value">The value</param> | ||
/// <returns>True or False based on whether the item is added successfully</returns> | ||
public static bool TryAdd<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TValue value) | ||
{ | ||
if(dictionary == null) | ||
{ | ||
throw new ArgumentNullException(nameof(dictionary)); | ||
} | ||
|
||
if(!dictionary.ContainsKey(key)) | ||
{ | ||
dictionary.Add(key, value); | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
} | ||
} |
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
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