Uri.AbsoluteUri 属性

定义

获取绝对 URI。

C#
public string AbsoluteUri { get; }

属性值

String

整个 URI。

例外

此实例代表一个相对 URI,而此属性仅对绝对 URI 有效。

示例

以下示例将实例的完整内容 Uri 写入控制台。 在所示的示例中, http://www.contoso.com/catalog/shownew.htm?date=today 写入控制台。

C#
Uri baseUri= new Uri("http://www.contoso.com");
Uri myUri = new Uri(baseUri,"catalog/shownew.htm?date=today");
Console.WriteLine(myUri.AbsoluteUri);

注解

AbsoluteUri 属性包括实例中 Uri 存储的整个 URI,包括所有片段和查询字符串。

适用于

产品 版本
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1
UWP 10.0