mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-16 15:16:53 +01:00
* . * Use ILRepack to include Microsoft.OpenApi as internal * ... * OpenApiSpecificationVersion * . * 080 * 4
22 lines
484 B
C#
22 lines
484 B
C#
// Copyright © WireMock.Net
|
|
|
|
#if NET46 || NETSTANDARD2_0
|
|
using System.Collections.Generic;
|
|
|
|
namespace WireMock.Net.OpenApiParser.Extensions;
|
|
|
|
internal static class DictionaryExtensions
|
|
{
|
|
public static bool TryAdd<TKey, TValue>(this Dictionary<TKey, TValue>? dictionary, TKey key, TValue value)
|
|
{
|
|
if (dictionary is null || dictionary.ContainsKey(key))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
dictionary[key] = value;
|
|
|
|
return true;
|
|
}
|
|
}
|
|
#endif |