System.Xml.Schema.Datatype_dateTimeBase.TryParseValue C# (CSharp) Method

TryParseValue() private method

private TryParseValue ( string s, XmlNameTable nameTable, IXmlNamespaceResolver nsmgr, object &typedValue ) : Exception
s string
nameTable System.Xml.XmlNameTable
nsmgr IXmlNamespaceResolver
typedValue object
return System.Exception
        internal override Exception TryParseValue(string s, XmlNameTable nameTable, IXmlNamespaceResolver nsmgr, out object typedValue)
        {
            Exception exception;
            typedValue = null;

            exception = dateTimeFacetsChecker.CheckLexicalFacets(ref s, this);
            if (exception != null) goto Error;

            XsdDateTime dateTime;
            if (!XsdDateTime.TryParse(s, _dateTimeFlags, out dateTime))
            {
                exception = new FormatException(SR.Format(SR.XmlConvert_BadFormat, s, _dateTimeFlags.ToString()));
                goto Error;
            }

            DateTime dateTimeValue = DateTime.MinValue;
            try
            {
                dateTimeValue = (DateTime)dateTime;
            }
            catch (ArgumentException e)
            {
                exception = e;
                goto Error;
            }

            exception = dateTimeFacetsChecker.CheckValueFacets(dateTimeValue, this);
            if (exception != null) goto Error;

            typedValue = dateTimeValue;

            return null;

        Error:
            return exception;
        }
    }