System.Uri.CreateThis C# (CSharp) Method

CreateThis() private method

private CreateThis ( string uri, bool dontEscape, UriKind uriKind ) : void
uri string
dontEscape bool
uriKind UriKind
return void
        private void CreateThis(string uri, bool dontEscape, UriKind uriKind)
        {
            // if (!Enum.IsDefined(typeof(UriKind), uriKind)) -- We currently believe that Enum.IsDefined() is too slow 
            // to be used here.
            if ((int)uriKind < (int)UriKind.RelativeOrAbsolute || (int)uriKind > (int)UriKind.Relative)
            {
                throw new ArgumentException(SR.Format(SR.net_uri_InvalidUriKind, uriKind));
            }

            _string = uri == null ? string.Empty : uri;

            if (dontEscape)
                _flags |= Flags.UserEscaped;

            ParsingError err = ParseScheme(_string, ref _flags, ref _syntax);
            UriFormatException e;

            InitializeUri(err, uriKind, out e);
            if (e != null)
                throw e;
        }