Partilhar via


CLRInterop.Null(String) Method

Definition

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

public:
 static System::Object ^ Null(System::String ^ _clrTypeName);
public static object Null (string _clrTypeName);
static member Null : string -> obj
Public Shared Function Null (_clrTypeName As String) As Object

Parameters

_clrTypeName
String

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

Returns

A CLRObject instance of the specified CLR data type.

Remarks

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); 
}

Applies to