IpcServerChannel.GetUrlsForUri(String) 方法

定义

返回具有指定 URI 的对象的所有 URL 的数组,该对象承载在当前的 IpcChannel 实例上。

public:
 virtual cli::array <System::String ^> ^ GetUrlsForUri(System::String ^ objectUri);
public virtual string[] GetUrlsForUri (string objectUri);
abstract member GetUrlsForUri : string -> string[]
override this.GetUrlsForUri : string -> string[]
Public Overridable Function GetUrlsForUri (objectUri As String) As String()

参数

objectUri
String

需要其 URL 的对象的 URI。

返回

String[]

具有指定 URI 的对象的 URL 的数组,该对象承载在当前的 TcpChannel 实例上。

实现

示例

下面的代码示例说明如何使用 GetUrlsForUri 方法。

// 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 该方法使用。

适用于