System.Data.DataRelationCollection.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 Relation.RelationName 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)
        {
            DataCommonEventSource.Log.Trace("<ds.DataRelationCollection.RegisterName|INFO> {0}, name='{1}'", ObjectID, name);
            Debug.Assert(name != null);

            CultureInfo locale = GetDataSet().Locale;
            int relationCount = Count;
            for (int i = 0; i < relationCount; i++)
            {
                if (NamesEqual(name, this[i].RelationName, true, locale) != 0)
                {
                    throw ExceptionBuilder.DuplicateRelation(this[i].RelationName);
                }
            }
            if (NamesEqual(name, MakeName(_defaultNameIndex), true, locale) != 0)
            {
                _defaultNameIndex++;
            }
        }