/// <summary> /// Converts an IEnumerable collection to Dictionary /// </summary> /// <typeparam name="TSource">The type of the collection</typeparam> /// <typeparam name="TKey">The type of the key of the FlexibleDictionary</typeparam> /// <typeparam name="TValue">The type of the value of the FlexibleDictionary</typeparam> /// <param name="source">The type of the IEnumerable collection</param> /// <param name="keySelector">Function for determining the key of the FlexibleDictionary</param> /// <param name="valueSelector">Function for determining the value of the collection</param> /// <returns></returns> public static FlexibleDictionary <TKey, TValue> ToFlexibleDictionary <TSource, TKey, TValue>(this IEnumerable <TSource> source, Func <TSource, TKey> keySelector, Func <TSource, TValue> valueSelector) { FlexibleDictionary <TKey, TValue> toReturn = new FlexibleDictionary <TKey, TValue>(); foreach (TSource eachItem in source) { toReturn.Add(keySelector(eachItem), valueSelector(eachItem)); } //end foreach return(toReturn); } //end static FlexibleDictionary<TKey, TValue> ToFlexibleDictionary