string[] str = new string[4]; str[0] = "shivu"; str[1] = "Anil"; str[2] = "shivu"; str[3] = "Anil"; str = RemoveDups(str, true);The out put of array will be "shivu" and "Anil"//Method for filtering the duplicates items.. public string[] RemoveDups(string[] items, bool sort) { string[] uniqueItems = null; try { ArrayList noDups = new ArrayList(); for (int i = 0; i < items.Length; i++) { if (!noDups.Contains(items[i].Trim())) { noDups.Add(items[i].Trim()); } } if (sort) noDups.Sort(); //sorts list alphabetically uniqueItems = new String[noDups.Count]; noDups.CopyTo(uniqueItems); } catch (Exception ex) { throw ex; } return uniqueItems; }