System.Collections.Specialized.ListDictionary.Contains C# (CSharp) Method

Contains() public method

public Contains ( object key ) : bool
key object
return bool
        public bool Contains(object key) { throw null; }
        public void CopyTo(System.Array array, int index) { }

Usage Example

Example #1
0
        /// <summary>
        /// Returns true if all items in <paramref name="names0"/> and <paramref name="names1"/> are 
        /// unique strings.  Case sensitivity consideration depends on <paramref name="ignoreCase"/>.
        /// </summary>
        /// <param name="names0">An array of strings.</param>
        /// <param name="names1">An array of strings.</param>
        /// <param name="ignoreCase">If true then case is not considered when comparing strings.</param>
        /// <returns>bool</returns>
        public static bool AreNamesUnique(string[] names0, string[] names1, bool ignoreCase)
        {
            bool result = true;
            if (names0 == null && names1 == null)
                return result;

            ListDictionary dic = new ListDictionary(StringComparer.Create(new CultureInfo("en"), ignoreCase));

            for (int i = 0; i < names0.Length; i++)
            {
                if (dic.Contains(names0[i]))
                {
                    result = false;
                    break;
                }
                dic.Add(names0[i], null);
            }
            for (int i = 0; i < names1.Length; i++)
            {
                if (dic.Contains(names1[i]))
                {
                    result = false;
                    break;
                }
                dic.Add(names1[i], null);
            }
            if (dic.Count == 0)
                result = false; // when both arrays are empty
            return result;
        }
All Usage Examples Of System.Collections.Specialized.ListDictionary::Contains