Partilhar via


DictClass.Callobject(String, XppObjectBase, Object[]) Method

Definition

Calls a method on an object.

public:
 virtual System::Object ^ Callobject(System::String ^ _methodName, Microsoft::Dynamics::Ax::Xpp::XppObjectBase ^ _Called, cli::array <System::Object ^> ^ varArgs);
[Microsoft.Dynamics.Ax.Xpp.VarArgs]
public virtual object Callobject (string _methodName, Microsoft.Dynamics.Ax.Xpp.XppObjectBase _Called, object[] varArgs);
[<Microsoft.Dynamics.Ax.Xpp.VarArgs>]
abstract member Callobject : string * Microsoft.Dynamics.Ax.Xpp.XppObjectBase * obj[] -> obj
override this.Callobject : string * Microsoft.Dynamics.Ax.Xpp.XppObjectBase * obj[] -> obj
Public Overridable Function Callobject (_methodName As String, _Called As XppObjectBase, varArgs As Object()) As Object

Parameters

_methodName
String
_Called
XppObjectBase
varArgs
Object[]

Returns

An anytype data type value that is returned by the specified method.

Attributes

Remarks

You must create an instance of the DictClass object by using a class that contains the method that you pass to the callObject method. If an attacker can control the input to the callObject method, a security risk exists. Therefore, this method runs under code access security. Calls to this method on the server require permission from the InteropPermission class. Make sure that the user has development rights by setting the security key to SysDevelopment on the control that calls this method.

This example calls the toString instance method in the Info class, for which the global instance of this class is named infolog, and then prints the value that is returned from the call.

static void Job_Example_DictClass_CallObject(Args _args) 
{ 
    DictClass dictClass; 
    anytype   retVal; 
    str      resultOutput; 
    ExecutePermission perm; 
    perm = new ExecutePermission(); 
    // Grants permission to execute the DictClass.callObject method. 
    // DictClass.callObject runs under code access security. 
    perm.assert(); 
    dictClass = new DictClass(classidget(infolog)); 
    if (dictClass != null) 
    { 
        retVal       = dictClass.callObject("toString", infolog); 
        resultOutput = strfmt("Return value is %1", retVal); 
        print resultOutput; 
        pause; 
    } 
    // Closes the code access permission scope. 
    CodeAccessPermission::revertAssert(); 
}

Applies to