13 lines
400 B
C#
13 lines
400 B
C#
// 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;
|
|
}
|
|
}
|
|
} |