/// <summary> /// returns a copy of the given set as a <see cref="CharArraySet"/>. If the given set /// is a <see cref="CharArraySet"/> the ignoreCase property will be preserved. /// </summary> /// <param name="set">A set to copy</param> /// <returns>a copy of the given set as a <see cref="CharArraySet"/>. If the given set /// is a <see cref="CharArraySet"/> the ignoreCase property will be preserved.</returns> public static CharArraySet Copy <T>(ISet <T> set) { if (set == null) { throw new ArgumentNullException("set", "Given set is null!"); } if (set == EMPTY_SET) { return(EMPTY_SET); } bool ignoreCase = set is CharArraySet && ((CharArraySet)set)._IgnoreCase; var arrSet = new CharArraySet(set.Count, ignoreCase); arrSet.AddItems(set); return(arrSet); }