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)

注解

属性返回用于Uri初始化实例的方案。 SchemeThe 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.

适用于