System.Data.DataColumn.SetMaxLengthSimpleType C# (CSharp) Method

SetMaxLengthSimpleType() private method

private SetMaxLengthSimpleType ( ) : void
return void
        private void SetMaxLengthSimpleType()
        {
            if (_simpleType != null)
            {
                Debug.Assert(_simpleType.CanHaveMaxLength(), "expected simpleType to be string");

                _simpleType.MaxLength = _maxLength;

                // check if we reset the simpleType back to plain string
                if (_simpleType.IsPlainString())
                {
                    _simpleType = null;
                }
                else
                {
                    // Named Simple Type's Name should not be null
                    if (_simpleType.Name != null && XmlDataType != null)
                    {
                        // if MaxLength is changed, we need to make  namedsimpletype annonymous simpletype
                        _simpleType.ConvertToAnnonymousSimpleType();
                        XmlDataType = null;
                    }
                }
            }
            else if (-1 < _maxLength)
            {
                SimpleType = SimpleType.CreateLimitedStringType(_maxLength);
            }
        }