兼容win7版应用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
491 B

using System.Collections.Generic;
namespace AIK.Views
{
/// <summary>
/// .NET Framework 4.8 兼容扩展方法(替代 Dictionary.GetValueOrDefault,该 API 在 net48 中不存在)
/// </summary>
internal static class DictionaryExtensions
{
internal static TValue? GetValueOrDefault<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey key)
{
return dictionary.TryGetValue(key, out var value) ? value : default;
}
}
}