SlunkCrypt/gui/Utilities/DictionaryHelper.cs

19 lines
755 B
C#
Raw Normal View History

/******************************************************************************/
/* SlunkCrypt, by LoRd_MuldeR <MuldeR2@GMX.de> */
/* This work has been released under the CC0 1.0 Universal license! */
/******************************************************************************/
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace com.muldersoft.slunkcrypt.gui.utils
{
public static class DictionaryHelper
{
public static IReadOnlyDictionary<K, V> ToReadOnlyDictionary<K, V>(this IDictionary<K, V> dict)
{
return (dict is ReadOnlyDictionary<K, V>) ? ((ReadOnlyDictionary<K, V>)dict) : new ReadOnlyDictionary<K, V>(dict);
}
}
}