System.Data.Common.DataColumnMappingCollection.Validate C# (CSharp) Method

Validate() private method

private Validate ( int index, DataColumnMapping value ) : void
index int
value DataColumnMapping
return void
        private void Validate(int index, DataColumnMapping value)
        {
            if (null == value)
            {
                throw ADP.ColumnsAddNullAttempt(nameof(value));
            }
            if (null != value.Parent)
            {
                if (this != value.Parent)
                {
                    throw ADP.ColumnsIsNotParent(this);
                }
                else if (index != IndexOf(value))
                {
                    throw ADP.ColumnsIsParent(this);
                }
            }

            string name = value.SourceColumn;
            if (string.IsNullOrEmpty(name))
            {
                index = 1;
                do
                {
                    name = ADP.SourceColumn + index.ToString(System.Globalization.CultureInfo.InvariantCulture);
                    index++;
                } while (-1 != IndexOf(name));
                value.SourceColumn = name;
            }
            else
            {
                ValidateSourceColumn(index, name);
            }
        }