Directory.CreateVariable Method

This method creates a variable.

Namespace:  IntervalZero.MaxRT.Libraries.VariableDatabase
Assembly:  IntervalZero.MaxRT.Libraries (in IntervalZero.MaxRT.Libraries.dll) Version: 1.0.0.0 (File version: 1.0.1)

Syntax

Copy
public Variable CreateVariable(
    string name,
    DataType type
)

Parameters

name

Type: String
The variable name to create. The maximum name length is 63 characters.

type

Type: DataType
The variable type to create.

Return Value

Type: Variable
The class that controls the variable.

InvalidOperationException is thrown when the directory is not open.

ArgumentNullException is thrown when parameter name is null.

ArgumentException is thrown when parameter name is empty.

MaxRTNativeException is thrown when these errors occur:

Error code Meaning

ERROR_INVALID_PARAMETER

The value of parameter name exceeds 63 characters in length.

ERROR_ALREADY_EXISTS

A variable with this name already exists in the parent directory.

ERROR_ABANDONED_WAIT_0

Failed to acquire the synchronization lock.

ERROR_NOT_ENOUGH_MEMORY

Failed to allocate memory.

ERROR_UNSUPPORTED_TYPE

variable.Type is below VarBool or above VarDouble.

See Also: