共用方式為


ChannelServices.GetUrlsForObject(MarshalByRefObject) 方法

定義

傳回可以用來取得指定物件之所有 URL 的陣列。

public:
 static cli::array <System::String ^> ^ GetUrlsForObject(MarshalByRefObject ^ obj);
public static string[] GetUrlsForObject (MarshalByRefObject obj);
[System.Security.SecurityCritical]
public static string[] GetUrlsForObject (MarshalByRefObject obj);
static member GetUrlsForObject : MarshalByRefObject -> string[]
[<System.Security.SecurityCritical>]
static member GetUrlsForObject : MarshalByRefObject -> string[]
Public Shared Function GetUrlsForObject (obj As MarshalByRefObject) As String()

參數

obj
MarshalByRefObject

要為其擷取 URL 陣列的物件。

傳回

String[]

字串陣列,其中包含可以用來從遠端識別物件的 URL,但如果沒有找到任何 URL 的話,則為 null

屬性

例外狀況

立即呼叫端沒有基礎結構使用權限。

範例

array<String^>^myURLArray = ChannelServices::GetUrlsForObject( myHelloServer );
Console::WriteLine( "Number of URLs for the specified Object: {0}", myURLArray->Length );
for ( int iIndex = 0; iIndex < myURLArray->Length; iIndex++ )
   Console::WriteLine( "URL: {0}", myURLArray[ iIndex ] );
string[] myURLArray = ChannelServices.GetUrlsForObject(myHelloServer);
Console.WriteLine("Number of URLs for the specified Object: "
   +myURLArray.Length);
for (int iIndex=0; iIndex<myURLArray.Length; iIndex++)
   Console.WriteLine("URL: "+myURLArray[iIndex]);
Dim myURLArray As String() = ChannelServices.GetUrlsForObject(myHelloServer)
Console.WriteLine("Number of URLs for the specified Object: " + _
                                             myURLArray.Length.ToString())
Dim iIndex As Integer
For iIndex = 0 To myURLArray.Length - 1
   Console.WriteLine("URL: " + myURLArray(iIndex))
Next iIndex

適用於