Uri.SchemeDelimiter 欄位
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
指定將通訊協定方案與 URI 位址部分區分開的字元。 此欄位僅供讀取。
public: static initonly System::String ^ SchemeDelimiter;
public static readonly string SchemeDelimiter;
staticval mutable SchemeDelimiter : string
Public Shared ReadOnly SchemeDelimiter As String
欄位值
範例
以下範例由 、 UriSchemeHttpSchemeDelimiter及一個位址組成字串。 接著由字串建立一個 Uri 實例。
string address = "www.contoso.com";
string uriString = String.Format("{0}{1}{2}/", Uri.UriSchemeHttp, Uri.SchemeDelimiter, address);
#if OLDMETHOD
Uri result;
if (Uri.TryParse(uriString, false, false, out result))
Console.WriteLine("{0} is a valid Uri", result.ToString());
else
Console.WriteLine("Uri not created");
#endif
Uri result = new Uri(uriString);
if (result.IsWellFormedOriginalString())
Console.WriteLine("{0} is a well formed Uri", uriString);
else
Console.WriteLine("{0} is not a well formed Uri", uriString);
let address = "www.contoso.com"
let uriString = $"{Uri.UriSchemeHttp}{Uri.SchemeDelimiter}{address}/"
#if OLDMETHOD
match Uri.TryParse(uriString, false, false) with
| true, result ->
printfn $"{result} is a valid Uri"
| _ ->
printfn "Uri not created"
#endif
let result = Uri uriString
if result.IsWellFormedOriginalString() then
printfn $"{uriString} is a well formed Uri"
else
printfn $"{uriString} is not a well formed Uri"
Dim address As String = "www.contoso.com"
Dim uriString As String = String.Format("{0}{1}{2}", Uri.UriSchemeHttp, Uri.SchemeDelimiter, address)
Dim result As Uri = New Uri(uriString)
If result.IsWellFormedOriginalString() = True Then
Console.WriteLine("{0} is a well formed Uri", uriString)
else
Console.WriteLine("{0} is not a well formed Uri", uriString)
End If