DictClass.callStatic Method

Calls a static method.

Syntax

public anytype callStatic(str methodName,  )

Run On

Called

Parameters

  • methodName
    Type: str
    A string data type that indicates the name of the method to call.
  • Type: [T:]

Return Value

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

Remarks

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

Examples

This example calls the AOSClientMode method in the Session class and then prints the value returned from the call.

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

See Also

DictClass Class

Anytype