Sicherung
This commit is contained in:
16
Config.Net/Core/Extensions.cs
Normal file
16
Config.Net/Core/Extensions.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Config.Net.Core
|
||||
{
|
||||
static class Extensions
|
||||
{
|
||||
public static TValue? GetValueOrDefaultInternal<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key)
|
||||
where TKey: notnull
|
||||
where TValue: class
|
||||
{
|
||||
if (!dictionary.TryGetValue(key, out TValue? value)) return default(TValue);
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user