CSharp examples for System:String Case
Remove Duplicate String and Ignore Case
using System.Linq; using System.Text; using System.Globalization; using System.ComponentModel; using System.Collections.Generic; using System.Collections; public class Main{ public static List<string> RemoveDuplicatesIgnoreCase(this IList<string> values) {//from w w w. j a v a2 s. c o m var duplicateCheck = new HashSet<string>(StringComparer.OrdinalIgnoreCase); var res = new List<string>(values.Count); foreach (var value in values) { if (duplicateCheck.Contains(value)) { continue; } duplicateCheck.Add(value); res.Add(value); } return res; } public static bool Contains<T>(this IEnumerable<T> me, Predicate<T> condition) { foreach (var val in me) { if (condition(val)) return true; } return false; } }