c# uri.host_C#| Uri.HostNameType属性与示例
c# uri.host
Uri.HostNameType屬性 (Uri.HostNameType Property)
Uri.HostNameType Property is the instance property of Uri class which used to get the type of hostname specified in the given URI. This property returns a string value. This property may generate System.InvalidOperationException exception.
Uri.HostNameType屬性是Uri類的實例屬性,用于獲取給定URI中指定的主機名類型。 此屬性返回一個字符串值。 此屬性可能會生成System.InvalidOperationException異常。
Syntax:
句法:
public UriHostNameType HostNameType { get; }Return value:
返回值:
The return type of this property is UriHostNameType, it returns a member of the UriHostNameType enumeration.
此屬性的返回類型為UriHostNameType ,它返回UriHostNameType枚舉的成員。
Example to demonstrate example of Uri.HostNameType Property
演示Uri.HostNameType屬性示例的示例
using System;class UriExample {//Entry point of Programstatic public void Main(){Uri domainUri;Uri newUri;domainUri = new Uri("https://www.includehelp.com:8082");newUri = new Uri(domainUri, "CPrograms.html?Top=10");System.Console.WriteLine("HostName Type: " + newUri.HostNameType);} }Output
輸出量
HostName Type: DnsIn the above program, we created an object of Uri class initialized with the website name with port number and we got the type of hostname from Uri using HostNameType property.
在上面的程序中,我們創建了一個Uri類的對象,該對象已初始化為帶有端口號的網站名稱,并使用HostNameType屬性從Uri獲得了主機名的類型。
Reference: Uri.HostNameType Property
參考: Uri.HostNameType屬性
翻譯自: https://www.includehelp.com/dot-net/uri-hostnametype-property-with-example.aspx
c# uri.host
總結
以上是生活随笔為你收集整理的c# uri.host_C#| Uri.HostNameType属性与示例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Java GregorianCalend
- 下一篇: innodb是如何存数据的?yyds