mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 01:24:44 +01:00
Add GetValueOrDefault dictionary extension
This commit is contained in:
14
MediaBrowser.Common/Extensions/CollectionExtensions.cs
Normal file
14
MediaBrowser.Common/Extensions/CollectionExtensions.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Common.Extensions
|
||||
{
|
||||
// The MS CollectionExtensions are only available in netcoreapp
|
||||
public static class CollectionExtensions
|
||||
{
|
||||
public static TValue GetValueOrDefault<TKey, TValue> (this IReadOnlyDictionary<TKey, TValue> dictionary, TKey key)
|
||||
{
|
||||
dictionary.TryGetValue(key, out var ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user