System.Data.ConstraintCollection.RegisterName C# (CSharp) Method

RegisterName() private method

Registers this name as being used in the collection. Will throw an ArgumentException if the name is already being used. Called by Add, All property, and Constraint.ConstraintName property. if the name is equivalent to the next default name to hand out, we increment our defaultNameIndex.
private RegisterName ( string name ) : void
name string
return void
        internal void RegisterName(string name)
        {
            Debug.Assert(name != null);

            int constraintCount = List.Count;
            for (int i = 0; i < constraintCount; i++)
            {
                if (NamesEqual(name, ((Constraint)List[i]).ConstraintName, true, _table.Locale) != 0)
                {
                    throw ExceptionBuilder.DuplicateConstraintName(((Constraint)List[i]).ConstraintName);
                }
            }
            if (NamesEqual(name, MakeName(_defaultNameIndex), true, _table.Locale) != 0)
            {
                _defaultNameIndex++;
            }
        }