SalSafeArray
Namespace: PPJ.Runtime.Com
Assembly: PPJ.Web.50 (5.0.0.0)
Wraps a managed array with SAL-compatible SAFEARRAY creation and typed element access.
- C#
- VB.NET
public class SalSafeArray : SalFunctionalClass
Public Class SalSafeArray
Inherits SalFunctionalClass
Dimension numbers are one-based; element indices use the lower bounds assigned when the array is created. Typed access requires the matching SAL element category. Invalid bounds and conversion failures may throw.
Example:
using PPJ.Runtime;
using PPJ.Runtime.Com;
var values = new SalSafeArray(new int[] { 10, 20 });
SalNumber first = 0;
if (values.GetNumber(ref first, 0))
System.Console.WriteLine(first);
Constructors
SalSafeArray()
Initializes a wrapper without an array.
SalSafeArray(array)
Wraps the supplied managed array and determines its element type.
| Name | Type | Description |
|---|---|---|
| array | Array | The managed array to wrap, or null. |
Properties
Value
Array: Gets or sets the managed array and updates the associated SAL and automation type codes.
Methods
Create(vt, elements, lowerBound)
Creates a one-dimensional managed array with the requested automation element type.
| Parameter | Type | Description |
|---|---|---|
| vt | SalNumber | The COM VarEnum code for the array element type. |
| elements | SalNumber | The element count, or the per-dimension element counts for a multidimensional array. |
| lowerBound | SalNumber | The first valid index. |
Returns: SalBoolean. True if the array is created; false if the automation type is undefined or unsupported.
Create2D(vt, elements1, elements2, lowerBound1, lowerBound2)
Creates a two-dimensional managed array with the requested automation element type.
| Parameter | Type | Description |
|---|---|---|
| vt | SalNumber | The COM VarEnum code for the array element type. |
| elements1 | SalNumber | The first dimension length. |
| elements2 | SalNumber | The second dimension length. |
| lowerBound1 | SalNumber | The first dimension lower bound. |
| lowerBound2 | SalNumber | The second dimension lower bound. |
Returns: SalBoolean. True if the array is created; false if the automation type is undefined or unsupported.
CreateMD(vt, elements, lowerBounds)
Creates a multidimensional managed array with the requested automation element type.
| Parameter | Type | Description |
|---|---|---|
| vt | SalNumber | The COM VarEnum code for the array element type. |
| elements | SalArray<SalNumber> | The element count, or the per-dimension element counts for a multidimensional array. |
| lowerBounds | SalArray<SalNumber> | The lower bound of each dimension, in dimension order. |
Returns: SalBoolean. True if the array is created; false if the automation type is undefined or unsupported.
GetBoolean(value, index)
Reads a boolean value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalBoolean | Receives the element value; an object wrapper is populated in place. |
| index | SalNumber | The element index within the array's declared bounds. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
GetBoolean2D(value, index1, index2)
Reads a boolean value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalBoolean | Receives the element value; an object wrapper is populated in place. |
| index1 | SalNumber | The element index in the first dimension. |
| index2 | SalNumber | The element index in the second dimension. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
GetBooleanMD(value, indices)
Reads a boolean value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalBoolean | Receives the element value; an object wrapper is populated in place. |
| indices | SalArray<SalNumber> | The element index for each dimension, in dimension order. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
GetDate(value, index)
Reads a date value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalDateTime | Receives the element value; an object wrapper is populated in place. |
| index | SalNumber | The element index within the array's declared bounds. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
GetDate2D(date, index1, index2)
Reads a date value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| date | SalDateTime | Receives the element value; an object wrapper is populated in place. |
| index1 | SalNumber | The element index in the first dimension. |
| index2 | SalNumber | The element index in the second dimension. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
GetDateMD(date, indices)
Reads a date value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| date | SalDateTime | Receives the element value; an object wrapper is populated in place. |
| indices | SalArray<SalNumber> | The element index for each dimension, in dimension order. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
GetLowerBound()
Gets the lower index of the first dimension.
Returns: SalNumber. The bound, or -1 when no array is attached.
GetLowerBound2D(nDim)
Gets the lower index of the specified dimension.
| Parameter | Type | Description |
|---|---|---|
| nDim | SalNumber | The one-based dimension number. |
Returns: SalNumber. The bound, or -1 when no array is attached.
GetLowerBoundMD(nDim)
Gets the lower index of the specified dimension.
| Parameter | Type | Description |
|---|---|---|
| nDim | SalNumber | The one-based dimension number. |
Returns: SalNumber. The bound, or -1 when no array is attached.
GetNumber(value, index)
Reads a number value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalNumber | Receives the element value; an object wrapper is populated in place. |
| index | SalNumber | The element index within the array's declared bounds. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
GetNumber2D(value, index1, index2)
Reads a number value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalNumber | Receives the element value; an object wrapper is populated in place. |
| index1 | SalNumber | The element index in the first dimension. |
| index2 | SalNumber | The element index in the second dimension. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
GetNumberMD(num, indices)
Reads a number value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| num | SalNumber | Receives the element value; an object wrapper is populated in place. |
| indices | SalArray<SalNumber> | The element index for each dimension, in dimension order. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
GetObject(value, index)
Reads a object value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalObject | Receives the element value; an object wrapper is populated in place. |
| index | SalNumber | The element index within the array's declared bounds. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
GetObject2D(value, index1, index2)
Reads a object value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalObject | Receives the element value; an object wrapper is populated in place. |
| index1 | SalNumber | The element index in the first dimension. |
| index2 | SalNumber | The element index in the second dimension. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
GetObjectMD(value, indices)
Reads a object value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalObject | Receives the element value; an object wrapper is populated in place. |
| indices | SalArray<SalNumber> | The element index for each dimension, in dimension order. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
GetString(value, index)
Reads a string value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalString | Receives the element value; an object wrapper is populated in place. |
| index | SalNumber | The element index within the array's declared bounds. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
GetString2D(value, index1, index2)
Reads a string value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalString | Receives the element value; an object wrapper is populated in place. |
| index1 | SalNumber | The element index in the first dimension. |
| index2 | SalNumber | The element index in the second dimension. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
GetStringMD(value, indices)
Reads a string value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalString | Receives the element value; an object wrapper is populated in place. |
| indices | SalArray<SalNumber> | The element index for each dimension, in dimension order. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
GetUpperBound()
Gets the upper index of the first dimension.
Returns: SalNumber. The bound, or -1 when no array is attached.
GetUpperBound2D(nDim)
Gets the upper index of the specified dimension.
| Parameter | Type | Description |
|---|---|---|
| nDim | SalNumber | The one-based dimension number. |
Returns: SalNumber. The bound, or -1 when no array is attached.
GetUpperBoundMD(nDim)
Gets the upper index of the specified dimension.
| Parameter | Type | Description |
|---|---|---|
| nDim | SalNumber | The one-based dimension number. |
Returns: SalNumber. The bound, or -1 when no array is attached.
GetVariant(value, index)
Reads a variant value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalVariant | Receives the element value; an object wrapper is populated in place. |
| index | SalNumber | The element index within the array's declared bounds. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
GetVariant2D(value, index1, index2)
Reads a variant value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalVariant | Receives the element value; an object wrapper is populated in place. |
| index1 | SalNumber | The element index in the first dimension. |
| index2 | SalNumber | The element index in the second dimension. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
GetVariantMD(value, indices)
Reads a variant value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalVariant | Receives the element value; an object wrapper is populated in place. |
| indices | SalArray<SalNumber> | The element index for each dimension, in dimension order. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
PutBoolean(value, index)
Writes a boolean value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalBoolean | The value to store in the array element. |
| index | SalNumber | The element index within the array's declared bounds. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
PutBoolean2D(value, index1, index2)
Writes a boolean value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalBoolean | The value to store in the array element. |
| index1 | SalNumber | The element index in the first dimension. |
| index2 | SalNumber | The element index in the second dimension. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
PutBooleanMD(value, indices)
Writes a boolean value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalBoolean | The value to store in the array element. |
| indices | SalArray<SalNumber> | The element index for each dimension, in dimension order. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
PutDate(value, index)
Writes a date value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalDateTime | The value to store in the array element. |
| index | SalNumber | The element index within the array's declared bounds. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
PutDate2D(value, index1, index2)
Writes a date value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalDateTime | The value to store in the array element. |
| index1 | SalNumber | The element index in the first dimension. |
| index2 | SalNumber | The element index in the second dimension. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
PutDateMD(value, indices)
Writes a date value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalDateTime | The value to store in the array element. |
| indices | SalArray<SalNumber> | The element index for each dimension, in dimension order. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
PutNumber(value, index)
Writes a number value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalNumber | The value to store in the array element. |
| index | SalNumber | The element index within the array's declared bounds. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
PutNumber2D(value, index1, index2)
Writes a number value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalNumber | The value to store in the array element. |
| index1 | SalNumber | The element index in the first dimension. |
| index2 | SalNumber | The element index in the second dimension. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
PutNumberMD(value, indices)
Writes a number value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalNumber | The value to store in the array element. |
| indices | SalArray<SalNumber> | The element index for each dimension, in dimension order. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
PutObject(value, index)
Writes a object value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalObject | The value to store in the array element. |
| index | SalNumber | The element index within the array's declared bounds. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
PutObject2D(value, index1, index2)
Writes a object value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalObject | The value to store in the array element. |
| index1 | SalNumber | The element index in the first dimension. |
| index2 | SalNumber | The element index in the second dimension. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
PutObjectMD(value, indices)
Writes a object value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalObject | The value to store in the array element. |
| indices | SalArray<SalNumber> | The element index for each dimension, in dimension order. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
PutString(value, index)
Writes a string value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalString | The value to store in the array element. |
| index | SalNumber | The element index within the array's declared bounds. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
PutString2D(value, index1, index2)
Writes a string value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalString | The value to store in the array element. |
| index1 | SalNumber | The element index in the first dimension. |
| index2 | SalNumber | The element index in the second dimension. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
PutStringMD(value, indices)
Writes a string value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalString | The value to store in the array element. |
| indices | SalArray<SalNumber> | The element index for each dimension, in dimension order. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
PutVariant(value, index)
Writes a variant value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalVariant | The value to store in the array element. |
| index | SalNumber | The element index within the array's declared bounds. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
PutVariant2D(value, index1, index2)
Writes a variant value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalVariant | The value to store in the array element. |
| index1 | SalNumber | The element index in the first dimension. |
| index2 | SalNumber | The element index in the second dimension. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.
PutVariantMD(value, indices)
Writes a variant value at the specified array indices.
| Parameter | Type | Description |
|---|---|---|
| value | SalVariant | The value to store in the array element. |
| indices | SalArray<SalNumber> | The element index for each dimension, in dimension order. |
Returns: SalBoolean. True if the value is transferred; false if no array exists or the element category does not match.