Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Converts a common language runtime (CLR) object to a value of the X++ anytype data type.
Syntax
client server public static anytype getAnyTypeForObject(CLRObject clrObject)
Run On
Called
Parameters
- clrObject
Type: CLRObject Class
The CLR object to convert to an X++ data type.
Return Value
Type: anytype
An X++ anytype date type that has the value of the _object argument.
Remarks
If an attacker can control input to the getAnyTypeForObject 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 an X++ data type, an exception of the Exception::ClrError type is thrown.
Examples
The following example sets the value of a CLR string to an X++ str data type.
{
CLRObject clrObj;
InteropPermission perm;
System.String clrStr = "Calculate total";
str s;
perm = new InteropPermission(InteropKind::ClrInterop);
if (perm == null)
{
return;
}
perm.assert();
s = ClrInterop::getAnyTypeForObject(clrStr);
CodeAccessPermission::revertAssert();
}