/
Static Class Extensions

Static Class Extensions

static class Extensions { /// <summary> /// Throw ArgumentNullException if the object is null /// </summary> /// <param name="obj">the object itself</param> public static void ThrowIfNull(this object obj) { if(obj == null) { throw new ArgumentNullException(); } } /// <summary> /// Find the index of the key in the HashRingLocation /// </summary> /// <typeparam name="T">the type of the item</typeparam> /// <param name="sortedDict">the extension class</param> /// <param name="keyToFind">the key to find</param> /// <returns></returns> public static int IndexOfKey<T>(this SortedDictionary<uint, HashRingLocation<T>> sortedDict, UInt32 keyToFind) { var keys = sortedDict.Keys; if (!keys.Any(k => k == keyToFind)) return -1; var foundNdx = keys.ToList().IndexOf(keyToFind); return foundNdx; } }