CLRInterop::Null Method [AX 2012]

Returns a CLR data type that has a value of nullNothingnullptrunita null reference (Nothing in Visual Basic).

client server public static CLRObject Null(str clrTypeName)

Run On

Called

Parameters

clrTypeName
Type: str
The CLR data type to set to nullNothingnullptrunita null reference (Nothing in Visual Basic).

Return Value

Type: CLRObject Class
A CLRObject instance of the specified CLR data type.

If you directly set CLR data types to nullNothingnullptrunita null reference (Nothing in Visual Basic) in X++, you only set the kernel reference to nullNothingnullptrunita null reference (Nothing in Visual Basic). This will make it impossible to use the type as a CLR data type. If you assign the CLR data type to CLRInterop:null("yourType"),, the type can be parsed at run time as a parameter of a static method invocation.

The following example sets the CLR string type to nullNothingnullptrunita null reference (Nothing in Visual Basic) and assigns the type value to a CLR object.

static void Job5(Args _args) 
{ 
    System.String nullStr; 
     
    nullStr = CLRInterop::Null("System.String"); 
     
    print CLRInterop::isInitialized(nullStr); 
    print CLRInterop::isNull(nullStr); 
}
Show: