System.Uri.EscapeString C# (CSharp) Method

EscapeString() private method

private EscapeString ( string str ) : string
str string
return string
        protected static string EscapeString(string str)
        {
            // This method just does not make sense as protected
            // It should go public static asap

            if (str == null)
            {
                return string.Empty;
            }

            int destStart = 0;
            char[] dest = UriHelper.EscapeString(str, 0, str.Length, null, ref destStart, true, '?', '#', '%');
            if (dest == null)
                return str;
            return new string(dest, 0, destStart);
        }

Usage Example

Example #1
0
        /// <include file='doc\uribuilder.uex' path='docs/doc[@for="UriBuilder.UriBuilder5"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public UriBuilder(string scheme,
                          string host,
                          int port,
                          string pathValue
                          ) : this(scheme, host, port)
        {
            bool escaped;

            Path = Uri.EscapeString(ConvertSlashes(pathValue), false, out escaped);
        }
All Usage Examples Of System.Uri::EscapeString