Uri.CheckSchemeName(String) 메서드

정의

지정된 체계 이름이 유효한지 여부를 확인합니다.

public:
 static bool CheckSchemeName(System::String ^ schemeName);
public static bool CheckSchemeName (string schemeName);
public static bool CheckSchemeName (string? schemeName);
static member CheckSchemeName : string -> bool
Public Shared Function CheckSchemeName (schemeName As String) As Boolean

매개 변수

schemeName
String

유효성을 확인할 체계 이름입니다.

반환

Boolean

유효한 이름이면 true이고, 그렇지 않으면 false입니다.

예제

다음 예제에서는 인스턴스를 Uri 만들고 스키마 이름이 유효한지 확인합니다.

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 );
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)

설명

이 메서드는 기본적으로 RFC 2396에 따라 스키마 이름이 유효한지 확인합니다. URI(International Resource Identifiers) 또는 IDN(Internationalized Domain Name) 구문 분석이 사용되는 경우 이 메서드는 RFC 3986에 따라 체계 이름에서 유효성을 검사합니다. 체계 이름은 문자로 시작해야 하며 문자, 숫자 및 문자 ".", "+" 또는 "-"만 포함해야 합니다.

IRI 지원에 대한 자세한 내용은 클래스의 설명 섹션을 Uri 참조하세요.

적용 대상