当前位置: 首页 > 工具软件 > URI.js > 使用案例 >

c# uri.host_C#| Uri.EscapeUriString()方法与示例

夏建弼
2023-12-01

c# uri.host

Uri.EscapeUriString()方法 (Uri.EscapeUriString() Method)

Uri.EscapeUriString() method is a static method that is used to convert specified Uri string in escaped representation.

Uri.EscapeUriString()方法是一个静态方法,用于转换转义表示形式中的指定Uri字符串。

Syntax:

句法:

    string Uri.EscapeUriString(string StrToEsc);

Parameter(s):

参数:

  • string StrToEsc – represents the specified Uri string to be converted in escaped format.

    字符串StrToEsc –表示要以转义格式转换的指定Uri字符串。

Return value:

返回值:

The return type of this method is string, it returns escaped string.

此方法的返回类型为string ,它返回转义的字符串。

Exception(s):

例外情况:

    System.ArgumentNullException;
    System.UriFormatException;

Example to demonstrate example of Uri.EscapeUriString() method

演示Uri.EscapeUriString()方法示例的示例

using System;

class UriExample
{
    //Entry point of Program
    static public void Main()
    {

        string uriString1 = "https://www.includehelp.com/index.html";
        string uriString2 = "https://www.includehelp.com/default.aspx";

        string resultString = "";

        resultString = Uri.EscapeUriString(uriString1);
        Console.WriteLine(resultString);

        resultString = Uri.EscapeUriString(uriString2);
        Console.WriteLine(resultString);
    }
}

Output

输出量

https://www.includehelp.com/index.html
https://www.includehelp.com/default.aspx

翻译自: https://www.includehelp.com/dot-net/uri-escapeuristring-method-with-example.aspx

c# uri.host

 类似资料: