Init
This commit is contained in:
13
DictionaryExtensions.cs
Normal file
13
DictionaryExtensions.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
// DictionaryExtensions.cs
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace FreelancerListServer
|
||||
{
|
||||
public static class DictionaryExtensions
|
||||
{
|
||||
public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TValue defaultValue)
|
||||
{
|
||||
return dictionary.TryGetValue(key, out TValue value) ? value : defaultValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user