Share via


CLRInterop.getObjectForAnyType(Object) Method

Definition

Converts a value of the X++ anytype data type to a value of the CLRObject data type.

public:
 static System::Object ^ getObjectForAnyType(System::Object ^ value);
public static object getObjectForAnyType (object value);
static member getObjectForAnyType : obj -> obj
Public Shared Function getObjectForAnyType (value As Object) As Object

Parameters

value
Object

Returns

The CLR object that has the value of the _anytype argument.

Remarks

If an attacker can control input to the getObjectForAnyType method, a security risk exists. Therefore, this method runs under Code Access Security. Calls to this method on the server require permission. Make sure that the user has development privileges by setting the security key to SysDevelopment on the control that calls this method. If the argument cannot be converted to the CLRObject type, an exception of the Exception::CLRError type is thrown.

The following example converts a string value to a CLR string object.

static void Job3(Args _args) 
{ 
    CLRObject clrObj; 
    InteropPermission perm; 
    System.String s; 
    perm = new InteropPermission(InteropKind::ClrInterop); 
    if (perm == null) 
    { 
        return; 
    } 
    perm.assert(); 
    s = CLRInterop::getObjectForAnyType("Calculate total"); 
    CodeAccessPermission::revertAssert(); 
}

Applies to