Exemplo n.º 1
0
 /// <summary>
 /// Returns read only collection of given type
 /// </summary>
 /// <typeparam name="T">Type of collection</typeparam>
 /// <returns></returns>
 public static ReadOnlyCollection <T> ReadOnlyCollection <T>()
 {
     return(new ReadOnlyCollection <T>(Empty.List <T>()));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Returns read only dictionary of given type
 /// </summary>
 /// <typeparam name="TKey">Type of key</typeparam>
 /// <typeparam name="TValue">Type of value</typeparam>
 /// <returns></returns>
 public static ReadOnlyDictionary <TKey, TValue> ReadOnlyDictionary <TKey, TValue>()
 {
     return(new ReadOnlyDictionary <TKey, TValue>(Empty.Dictionary <TKey, TValue>()));
 }
Exemplo n.º 3
0
 /// <summary>
 /// If dictionary is null converts it into empty dictionary
 /// </summary>
 /// <typeparam name="TKey"></typeparam>
 /// <typeparam name="TValue"></typeparam>
 /// <param name="dict">Source dictionary</param>
 /// <returns></returns>
 public static IDictionary <TKey, TValue> Recover <TKey, TValue>(this IDictionary <TKey, TValue> dict)
 {
     return(dict ?? Empty.Dictionary <TKey, TValue>());
 }