CSharp examples for System:Array Element
Is char Array Duplicate
using System.Text; using System.Collections.Generic; using System;/*from w w w . j a v a2s. co m*/ public class Main{ public static bool IsArrayDuplicate(char[] chars) { // using HashSet in .Net 3.5+ Dictionary<char, object> dict = new Dictionary<char, object>(chars.Length); for (var i = 0; i < chars.Length; i++) { char c = chars[i]; if (dict.ContainsKey(c)) return true; else dict.Add(c, null); } return false; } }