IpcChannel.GetUrlsForUri(String) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
回傳一個包含指定 URI 物件的所有 URL 陣列,該物件託管於目前 IpcChannel的 。
public:
virtual cli::array <System::String ^> ^ GetUrlsForUri(System::String ^ objectURI);
public string[] GetUrlsForUri(string objectURI);
abstract member GetUrlsForUri : string -> string[]
override this.GetUrlsForUri : string -> string[]
Public Function GetUrlsForUri (objectURI As String) As String()
參數
- objectURI
- String
需要 URL 的物件的 URI。
傳回
String[]
一個物件的 URL 陣列,該物件具有指定的 URI,託管於目前 IpcChannel的 。
實作
範例
下列程式代碼範例示範如何使用 GetUrlsForUri 方法。 此程式碼範例是本類別更大範例 IpcChannel 的一部分。
// Parse the channel's URI.
array<String^>^ urls = serverChannel->GetUrlsForUri( L"RemoteObject.rem" );
if ( urls->Length > 0 )
{
String^ objectUrl = urls[ 0 ];
String^ objectUri;
String^ channelUri = serverChannel->Parse( objectUrl, objectUri );
Console::WriteLine( L"The object URI is {0}.", objectUri );
Console::WriteLine( L"The channel URI is {0}.", channelUri );
Console::WriteLine( L"The object URL is {0}.", objectUrl );
}
// Parse the channel's URI.
string[] urls = serverChannel.GetUrlsForUri("RemoteObject.rem");
if (urls.Length > 0)
{
string objectUrl = urls[0];
string objectUri;
string channelUri = serverChannel.Parse(objectUrl, out objectUri);
Console.WriteLine("The object URI is {0}.", objectUri);
Console.WriteLine("The channel URI is {0}.", channelUri);
Console.WriteLine("The object URL is {0}.", objectUrl);
}
備註
這個方法由 ChannelServices.GetUrlsForObject使用。