Uri.Scheme Uri.Scheme Uri.Scheme Uri.Scheme Property

定义

获取此 URI 的方案名称。Gets the scheme name for this URI.

public:
 property System::String ^ Scheme { System::String ^ get(); };
public string Scheme { get; }
member this.Scheme : string
Public ReadOnly Property Scheme As String

属性值

一个 String,包含此 URI 的方案(已转换为小写形式)。A String that contains the scheme for this URI, converted to lowercase.

异常

此实例代表一个相对 URI,而此属性仅对绝对 URI 有效。This instance represents a relative URI, and this property is valid only for absolute URIs.

示例

以下示例向控制台写入的方案名称 (http) http://www.contoso.com/ URI。The following example writes the scheme name (http) to the console for the http://www.contoso.com/ URI.

Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" );
Uri^ myUri = gcnew Uri( baseUri,"catalog/shownew.htm?date=today" );
Console::WriteLine( myUri->Scheme );
Uri baseUri = new Uri("http://www.contoso.com/");
 Uri myUri = new Uri(baseUri, "catalog/shownew.htm?date=today");
 
 Console.WriteLine(myUri.Scheme);
   
Dim baseUri As New Uri("http://www.contoso.com/")
Dim myUri As New Uri(baseUri, "catalog/shownew.htm?date=today")
       
Console.WriteLine(myUri.Scheme)

注解

Scheme属性返回用于初始化的方案Uri实例。The Scheme property returns the scheme used to initialize the Uri instance. 此属性不指示方案用来初始化Uri实例已识别出。This property does not indicate that the scheme used to initialize the Uri instance was recognized.

下表显示了返回的某些可能值的示例Scheme属性。The following table shows examples of some possible values returned by the Scheme property.

方案Scheme 描述Description
文件file 资源是本地计算机上的文件。The resource is a file on the local computer.
ftpftp 通过 FTP 访问资源。The resource is accessed through FTP.
gophergopher 通过 Gopher 协议访问资源。The resource is accessed through the Gopher protocol.
httphttp 通过 HTTP 访问资源。The resource is accessed through HTTP.
httpshttps 通过 SSL 加密的 HTTP 访问资源。The resource is accessed through SSL-encrypted HTTP.
ldapldap 通过 LDAP 协议访问资源。The resource is accessed through the LDAP protocol.
mailtomailto 资源是电子邮件地址,并通过 SMTP 协议访问。The resource is an email address and accessed through the SMTP protocol.
net.pipenet.pipe 通过命名管道访问资源。The resource is accessed through a named pipe.
net.tcpnet.tcp 从 TCP 终结点访问该资源。The resource is accessed from TCP endpoint.
newsnews 通过采用 NNTP 协议访问资源。The resource is accessed through the NNTP protocol.
nntpnntp 通过采用 NNTP 协议访问资源。The resource is accessed through the NNTP protocol.
telnettelnet 通过 TELNET 协议访问资源。The resource is accessed through the TELNET protocol.
uuiduuid 通过与服务通信的唯一 UUID 终结点名称访问资源。The resource is accessed through a unique UUID endpoint name for communicating with a service.

适用于