Uri.SchemeDelimiter Field
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Specifies the characters that separate the communication protocol scheme from the address portion of the URI. This field is read-only.
public: static initonly System::String ^ SchemeDelimiter;
public static readonly string SchemeDelimiter;
staticval mutable SchemeDelimiter : string
Public Shared ReadOnly SchemeDelimiter As String
Field Value
Examples
The following example creates a string from UriSchemeHttp, SchemeDelimiter, and an address. A Uri instance is then created from the string.
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, result ) == true )
{
Console::WriteLine( "{0} is a valid Uri", result );
}
else
{
Console::WriteLine( "Uri not created" );
}
#endif
Uri ^result = gcnew 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);
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) == true)
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
Applies to
ทํางานร่วมกับเราใน GitHub
แหล่งที่มาสำหรับเนื้อหานี้สามารถพบได้บน GitHub ซึ่งคุณยังสามารถสร้างและตรวจสอบปัญหาและคำขอดึงข้อมูลได้ สำหรับข้อมูลเพิ่มเติม ให้ดูคู่มือผู้สนับสนุนของเรา