ModuleServiceProxy.Invoke(String, Object[]) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
使用指定的引數呼叫指定的方法。
protected:
System::Object ^ Invoke(System::String ^ methodName, ... cli::array <System::Object ^> ^ parameters);
protected object Invoke(string methodName, params object[] parameters);
member this.Invoke : string * obj[] -> obj
Protected Function Invoke (methodName As String, ParamArray parameters As Object()) As Object
參數
- methodName
- String
所要叫用之方法的名稱。
傳回
來自所叫用的委派的傳回值,或者如果委派沒有任何傳回值,則為 null。
範例
下列範例示範 如何使用 Invoke 方法。
using System;
using System.Collections;
using Microsoft.Web.Management.Client;
namespace rxDemo {
internal class DemoModuleServiceProxy : ModuleServiceProxy {
public DemoModuleServiceProxy() : base() { }
public ArrayList GetSettings() {
return (ArrayList)Invoke("GetSettings");
}
}
}
internal class DemoPage : ModuleListPage {
public DemoPage() : base() { }
ModuleListPageGrouping _entryTypeGrouping;
// Invoke GetSettings from ModuleListPage derived class
private void GetSettingsMLP(object sender, DoWorkEventArgs e) {
try {
e.Result = _serviceProxy.GetSettings();
} catch (Exception ex) {
DisplayExceptionString(ex);
}
}
備註
只能傳遞.NET Framework類型;無法將任意物件當做參數傳遞。 傳遞的參數數目是任意的。