Uri.HostNameType プロパティ
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
URI に指定したホスト名の型を取得します。
public:
property UriHostNameType HostNameType { UriHostNameType get(); };
C#
public UriHostNameType HostNameType { get; }
member this.HostNameType : UriHostNameType
Public ReadOnly Property HostNameType As UriHostNameType
UriHostNameType 列挙体のメンバー。
このインスタンスは相対 URI を表します。このプロパティは、絶対 URI でのみ有効です。
次の例では、インスタンスを Uri 作成し、 HostNameType コンソールに書き込みます。
Uri^ address1 = gcnew Uri( "http://www.contoso.com/index.htm#search" );
Console::WriteLine( "address 1 {0} a valid scheme name",
Uri::CheckSchemeName( address1->Scheme ) ? (String^)" has" : " does not have" );
if ( address1->Scheme == Uri::UriSchemeHttp )
{
Console::WriteLine( "Uri is HTTP type" );
}
Console::WriteLine( address1->HostNameType );
C#
Uri address1 = new Uri("http://www.contoso.com/index.htm#search");
Console.WriteLine("address 1 {0} a valid scheme name",
Uri.CheckSchemeName(address1.Scheme) ? " has" : " does not have");
if (address1.Scheme == Uri.UriSchemeHttp)
Console.WriteLine("Uri is HTTP type");
Console.WriteLine(address1.HostNameType);
let address1 = Uri "http://www.contoso.com/index.htm#search"
printfn $"""address 1 {if Uri.CheckSchemeName address1.Scheme then " has" else " does not have"} a valid scheme name"""
if address1.Scheme = Uri.UriSchemeHttp then
printfn "Uri is HTTP type"
printfn $"{address1.HostNameType}"
Dim address1 As New Uri("http://www.contoso.com/index.htm#search")
Console.WriteLine("address 1 {0} a valid scheme name", IIf(Uri.CheckSchemeName(address1.Scheme), " has", " does not have")) 'TODO: For performance reasons this should be changed to nested IF statements
If address1.Scheme = Uri.UriSchemeHttp Then
Console.WriteLine("Uri is HTTP type")
End If
Console.WriteLine(address1.HostNameType)
製品 | バージョン |
---|---|
.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 |