COMVariant.safeArray Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
safeArray(Array, COMVariantType) | |
safeArray(Array) | |
safeArray() |
Gets or sets the value of a COMVariant object of the VT_SAFEARRAY data type. |
safeArray(Array, COMVariantType)
public:
virtual Microsoft::Dynamics::Ax::Xpp::Array ^ safeArray(Microsoft::Dynamics::Ax::Xpp::Array ^ _newValue, Dynamics::AX::Application::COMVariantType _newType);
public virtual Microsoft.Dynamics.Ax.Xpp.Array safeArray (Microsoft.Dynamics.Ax.Xpp.Array _newValue, Dynamics.AX.Application.COMVariantType _newType);
abstract member safeArray : Microsoft.Dynamics.Ax.Xpp.Array * Dynamics.AX.Application.COMVariantType -> Microsoft.Dynamics.Ax.Xpp.Array
override this.safeArray : Microsoft.Dynamics.Ax.Xpp.Array * Dynamics.AX.Application.COMVariantType -> Microsoft.Dynamics.Ax.Xpp.Array
Public Overridable Function safeArray (_newValue As Array, _newType As COMVariantType) As Array
Parameters
- _newValue
- Array
The type of the new array; optional.
- _newType
- COMVariantType
The type of the new array; optional.
Returns
Applies to
safeArray(Array)
public:
virtual Microsoft::Dynamics::Ax::Xpp::Array ^ safeArray(Microsoft::Dynamics::Ax::Xpp::Array ^ array1);
public virtual Microsoft.Dynamics.Ax.Xpp.Array safeArray (Microsoft.Dynamics.Ax.Xpp.Array array1);
abstract member safeArray : Microsoft.Dynamics.Ax.Xpp.Array -> Microsoft.Dynamics.Ax.Xpp.Array
override this.safeArray : Microsoft.Dynamics.Ax.Xpp.Array -> Microsoft.Dynamics.Ax.Xpp.Array
Public Overridable Function safeArray (array1 As Array) As Array
Parameters
- array1
- Array
Returns
Applies to
safeArray()
Gets or sets the value of a COMVariant object of the VT_SAFEARRAY data type.
public:
virtual Microsoft::Dynamics::Ax::Xpp::Array ^ safeArray();
public virtual Microsoft.Dynamics.Ax.Xpp.Array safeArray ();
abstract member safeArray : unit -> Microsoft.Dynamics.Ax.Xpp.Array
override this.safeArray : unit -> Microsoft.Dynamics.Ax.Xpp.Array
Public Overridable Function safeArray () As Array
Returns
The current array.
Remarks
If you pass in a value that has a different data type than the object, the data type of the object will be changed to match the data type of the value. A COMVariant object has an array Boolean type if its data type is set to COMVariantType::VT_SAFEARRAY. A safe array is COM's equivalent to an array. Currently only one-dimensional safe arrays are supported.
The following example creates a new COMVariant object of type VT_SAFEARRAY and initializes it with an array of shorts.
{
int i, result;
COM com;
COMVariant var = new COMVariant(
COMVariantInOut::IN_OUT,
COMVariantType::VT_SAFEARRAY);
Array arr = new Array(Types::INTEGER);
// Insert 10 values in the array
for (i = 1; i <= 10; i++)
{
arr.value(i, i);
}
// Set value of the object and ensure the integer values
// are treated as short data types
var.safeArray(arr, COMVariantType::VT_I2);
}