using System.Collections.Generic; namespace LLama.Extensions { internal static class DictionaryExtensions { #if NETSTANDARD2_0 public static TValue GetValueOrDefault(this IReadOnlyDictionary dictionary, TKey key, TValue defaultValue) { return GetValueOrDefaultImpl(dictionary, key, defaultValue); } #elif !NET6_0_OR_GREATER && !NETSTANDARD2_1_OR_GREATER #error Target framework not supported! #endif internal static TValue GetValueOrDefaultImpl(IReadOnlyDictionary dictionary, TKey key, TValue defaultValue) { return dictionary.TryGetValue(key, out var value) ? value : defaultValue; } } }