Skip to main content

SalSafeArray

Namespace: PPJ.Runtime.Com

Assembly: PPJ.Runtime.50 (5.0.0.0)

Wraps a managed array with SAL-compatible safe-array creation, bounds, and typed element access.

public class SalSafeArray : SalFunctionalClass

Dimension numbers used by the bounds methods start at one. Element indices use the actual lower bounds of the wrapped array. Typed access returns false when no array is assigned or its SAL element category differs; invalid indices and conversion failures can still throw exceptions. Assigning Value wraps the supplied array without copying it.

Example:

var values = new PPJ.Runtime.Com.SalSafeArray(new int[] { 10, 20 });
PPJ.Runtime.SalNumber item = 0;
if (values.GetNumber(ref item, 1))
values.PutNumber(item + 5, 1); // The second element is now 25.

Constructors

Instance member SalSafeArray()

Initializes a safe-array wrapper without an underlying array.

Instance member SalSafeArray(array)

Wraps the supplied managed array and detects its element type.

NameTypeDescription
arrayArrayThe array to wrap without copying, or null for an empty wrapper.

Properties

Instance member Value

Array: Gets or sets the managed array and updates the cached SAL and COM element-type codes when assigned.

Methods

Instance member Create(vt, elements, lowerBound)

Creates a new one-dimensional managed array and replaces the wrapped value.

ParameterTypeDescription
vtSalNumberA defined COM VarEnum element type that maps to a managed type.
elementsSalNumberThe number of elements.
lowerBoundSalNumberThe first valid element index.

Returns: SalBoolean. True after creating the array; false if the COM type is undefined or has no managed type mapping.

Array allocation and invalid dimension errors propagate to the caller.

Instance member Create2D(vt, elements1, elements2, lowerBound1, lowerBound2)

Creates a new two-dimensional managed array and replaces the wrapped value.

ParameterTypeDescription
vtSalNumberA defined COM VarEnum element type that maps to a managed type.
elements1SalNumberThe length of the first dimension.
elements2SalNumberThe length of the second dimension.
lowerBound1SalNumberThe lower bound of the first dimension.
lowerBound2SalNumberThe lower bound of the second dimension.

Returns: SalBoolean. True after creating the array; false if the COM type is undefined or has no managed type mapping.

Array allocation and invalid dimension errors propagate to the caller.

Instance member CreateMD(vt, elements, lowerBounds)

Creates a new multidimensional managed array and replaces the wrapped value.

ParameterTypeDescription
vtSalNumberA defined COM VarEnum element type that maps to a managed type.
elementsSalArray<SalNumber>A zero-based SAL array containing the length of each dimension.
lowerBoundsSalArray<SalNumber>A zero-based SAL array containing the lower bound of each corresponding dimension.

Returns: SalBoolean. True after creating the array; false if the COM type is undefined or has no managed type mapping.

Array allocation and invalid dimension errors propagate to the caller.

Instance member GetBoolean(boolean, index)

Reads a Boolean element in the one-dimensional array.

ParameterTypeDescription
boolean by referenceSalBooleanReceives the converted element on success; unchanged on a false return.
indexSalNumberThe element index within the array's actual bounds.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_BOOLEAN.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member GetBoolean2D(boolean, index1, index2)

Reads a Boolean element in the two-dimensional array.

ParameterTypeDescription
boolean by referenceSalBooleanReceives the converted element on success; unchanged on a false return.
index1SalNumberThe index in the first dimension.
index2SalNumberThe index in the second dimension.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_BOOLEAN.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member GetBooleanMD(boolean, indices)

Reads a Boolean element in the multidimensional array.

ParameterTypeDescription
boolean by referenceSalBooleanReceives the converted element on success; unchanged on a false return.
indicesSalArray<SalNumber>A zero-based SAL array containing one element index for each dimension.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_BOOLEAN.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member GetDate(date, index)

Reads a date/time element in the one-dimensional array.

ParameterTypeDescription
date by referenceSalDateTimeReceives the converted element on success; unchanged on a false return.
indexSalNumberThe element index within the array's actual bounds.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_DATE.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member GetDate2D(date, index1, index2)

Reads a date/time element in the two-dimensional array.

ParameterTypeDescription
date by referenceSalDateTimeReceives the converted element on success; unchanged on a false return.
index1SalNumberThe index in the first dimension.
index2SalNumberThe index in the second dimension.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_DATE.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member GetDateMD(date, indices)

Reads a date/time element in the multidimensional array.

ParameterTypeDescription
date by referenceSalDateTimeReceives the converted element on success; unchanged on a false return.
indicesSalArray<SalNumber>A zero-based SAL array containing one element index for each dimension.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_DATE.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member GetLowerBound()

Gets the lower element bound of the first dimension.

Returns: SalNumber. The array bound, or -1 if no array is assigned.

Instance member GetLowerBound2D(nDim)

Gets the lower element bound of the specified dimension.

ParameterTypeDescription
nDimSalNumberThe one-based dimension number.

Returns: SalNumber. The array bound, or -1 if no array is assigned.

Throws:

Instance member GetLowerBoundMD(nDim)

Gets the lower element bound of the specified dimension.

ParameterTypeDescription
nDimSalNumberThe one-based dimension number.

Returns: SalNumber. The array bound, or -1 if no array is assigned.

Throws:

Instance member GetNumber(num, index)

Reads a numeric element in the one-dimensional array.

ParameterTypeDescription
num by referenceSalNumberReceives the converted element on success; unchanged on a false return.
indexSalNumberThe element index within the array's actual bounds.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_NUMBER.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member GetNumber2D(num, index1, index2)

Reads a numeric element in the two-dimensional array.

ParameterTypeDescription
num by referenceSalNumberReceives the converted element on success; unchanged on a false return.
index1SalNumberThe index in the first dimension.
index2SalNumberThe index in the second dimension.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_NUMBER.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member GetNumberMD(num, indices)

Reads a numeric element in the multidimensional array.

ParameterTypeDescription
num by referenceSalNumberReceives the converted element on success; unchanged on a false return.
indicesSalArray<SalNumber>A zero-based SAL array containing one element index for each dimension.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_NUMBER.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member GetObject(obj, index)

Reads a object element in the one-dimensional array.

ParameterTypeDescription
objSalObjectAn existing wrapper whose Value receives the array element on success; unchanged on a false return.
indexSalNumberThe element index within the array's actual bounds.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_OBJECT.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member GetObject2D(obj, index1, index2)

Reads a object element in the two-dimensional array.

ParameterTypeDescription
objSalObjectAn existing wrapper whose Value receives the array element on success; unchanged on a false return.
index1SalNumberThe index in the first dimension.
index2SalNumberThe index in the second dimension.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_OBJECT.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member GetObjectMD(obj, indices)

Reads a object element in the multidimensional array.

ParameterTypeDescription
objSalObjectAn existing wrapper whose Value receives the array element on success; unchanged on a false return.
indicesSalArray<SalNumber>A zero-based SAL array containing one element index for each dimension.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_OBJECT.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member GetString(str, index)

Reads a string element in the one-dimensional array.

ParameterTypeDescription
str by referenceSalStringReceives the converted element on success; unchanged on a false return.
indexSalNumberThe element index within the array's actual bounds.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_STRING.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member GetString2D(str, index1, index2)

Reads a string element in the two-dimensional array.

ParameterTypeDescription
str by referenceSalStringReceives the converted element on success; unchanged on a false return.
index1SalNumberThe index in the first dimension.
index2SalNumberThe index in the second dimension.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_STRING.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member GetStringMD(str, indices)

Reads a string element in the multidimensional array.

ParameterTypeDescription
str by referenceSalStringReceives the converted element on success; unchanged on a false return.
indicesSalArray<SalNumber>A zero-based SAL array containing one element index for each dimension.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_STRING.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member GetUpperBound()

Gets the upper element bound of the first dimension.

Returns: SalNumber. The array bound, or -1 if no array is assigned.

Instance member GetUpperBound2D(nDim)

Gets the upper element bound of the specified dimension.

ParameterTypeDescription
nDimSalNumberThe one-based dimension number.

Returns: SalNumber. The array bound, or -1 if no array is assigned.

Throws:

Instance member GetUpperBoundMD(nDim)

Gets the upper element bound of the specified dimension.

ParameterTypeDescription
nDimSalNumberThe one-based dimension number.

Returns: SalNumber. The array bound, or -1 if no array is assigned.

Throws:

Instance member GetVariant(variant, index)

Reads a variant element in the one-dimensional array.

ParameterTypeDescription
variant by referenceSalVariantReceives the converted element on success; unchanged on a false return.
indexSalNumberThe element index within the array's actual bounds.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_VARIANT.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member GetVariant2D(variant, index1, index2)

Reads a variant element in the two-dimensional array.

ParameterTypeDescription
variant by referenceSalVariantReceives the converted element on success; unchanged on a false return.
index1SalNumberThe index in the first dimension.
index2SalNumberThe index in the second dimension.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_VARIANT.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member GetVariantMD(variant, indices)

Reads a variant element in the multidimensional array.

ParameterTypeDescription
variant by referenceSalVariantReceives the converted element on success; unchanged on a false return.
indicesSalArray<SalNumber>A zero-based SAL array containing one element index for each dimension.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_VARIANT.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member PutBoolean(boolean, index)

Writes a Boolean element in the one-dimensional array.

ParameterTypeDescription
booleanSalBooleanThe value whose underlying managed value is stored in the array.
indexSalNumberThe element index within the array's actual bounds.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_BOOLEAN.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member PutBoolean2D(boolean, index1, index2)

Writes a Boolean element in the two-dimensional array.

ParameterTypeDescription
booleanSalBooleanThe value whose underlying managed value is stored in the array.
index1SalNumberThe index in the first dimension.
index2SalNumberThe index in the second dimension.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_BOOLEAN.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member PutBooleanMD(boolean, indices)

Writes a Boolean element in the multidimensional array.

ParameterTypeDescription
booleanSalBooleanThe value whose underlying managed value is stored in the array.
indicesSalArray<SalNumber>A zero-based SAL array containing one element index for each dimension.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_BOOLEAN.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member PutDate(date, index)

Writes a date/time element in the one-dimensional array.

ParameterTypeDescription
dateSalDateTimeThe value whose underlying managed value is stored in the array.
indexSalNumberThe element index within the array's actual bounds.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_DATE.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member PutDate2D(date, index1, index2)

Writes a date/time element in the two-dimensional array.

ParameterTypeDescription
dateSalDateTimeThe value whose underlying managed value is stored in the array.
index1SalNumberThe index in the first dimension.
index2SalNumberThe index in the second dimension.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_DATE.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member PutDateMD(date, indices)

Writes a date/time element in the multidimensional array.

ParameterTypeDescription
dateSalDateTimeThe value whose underlying managed value is stored in the array.
indicesSalArray<SalNumber>A zero-based SAL array containing one element index for each dimension.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_DATE.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member PutNumber(num, index)

Writes a numeric element in the one-dimensional array.

ParameterTypeDescription
numSalNumberThe value whose underlying managed value is stored in the array.
indexSalNumberThe element index within the array's actual bounds.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_NUMBER.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member PutNumber2D(num, index1, index2)

Writes a numeric element in the two-dimensional array.

ParameterTypeDescription
numSalNumberThe value whose underlying managed value is stored in the array.
index1SalNumberThe index in the first dimension.
index2SalNumberThe index in the second dimension.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_NUMBER.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member PutNumberMD(num, indices)

Writes a numeric element in the multidimensional array.

ParameterTypeDescription
numSalNumberThe value whose underlying managed value is stored in the array.
indicesSalArray<SalNumber>A zero-based SAL array containing one element index for each dimension.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_NUMBER.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member PutObject(obj, index)

Writes a object element in the one-dimensional array.

ParameterTypeDescription
objSalObjectThe value whose underlying managed value is stored in the array.
indexSalNumberThe element index within the array's actual bounds.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_OBJECT.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member PutObject2D(obj, index1, index2)

Writes a object element in the two-dimensional array.

ParameterTypeDescription
objSalObjectThe value whose underlying managed value is stored in the array.
index1SalNumberThe index in the first dimension.
index2SalNumberThe index in the second dimension.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_OBJECT.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member PutObjectMD(obj, indices)

Writes a object element in the multidimensional array.

ParameterTypeDescription
objSalObjectThe value whose underlying managed value is stored in the array.
indicesSalArray<SalNumber>A zero-based SAL array containing one element index for each dimension.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_OBJECT.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member PutString(str, index)

Writes a string element in the one-dimensional array.

ParameterTypeDescription
strSalStringThe value whose underlying managed value is stored in the array.
indexSalNumberThe element index within the array's actual bounds.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_STRING.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member PutString2D(str, index1, index2)

Writes a string element in the two-dimensional array.

ParameterTypeDescription
strSalStringThe value whose underlying managed value is stored in the array.
index1SalNumberThe index in the first dimension.
index2SalNumberThe index in the second dimension.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_STRING.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member PutStringMD(str, indices)

Writes a string element in the multidimensional array.

ParameterTypeDescription
strSalStringThe value whose underlying managed value is stored in the array.
indicesSalArray<SalNumber>A zero-based SAL array containing one element index for each dimension.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_STRING.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member PutVariant(variant, index)

Writes a variant element in the one-dimensional array.

ParameterTypeDescription
variantSalVariantThe value whose underlying managed value is stored in the array.
indexSalNumberThe element index within the array's actual bounds.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_VARIANT.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member PutVariant2D(variant, index1, index2)

Writes a variant element in the two-dimensional array.

ParameterTypeDescription
variantSalVariantThe value whose underlying managed value is stored in the array.
index1SalNumberThe index in the first dimension.
index2SalNumberThe index in the second dimension.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_VARIANT.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.

Instance member PutVariantMD(variant, indices)

Writes a variant element in the multidimensional array.

ParameterTypeDescription
variantSalVariantThe value whose underlying managed value is stored in the array.
indicesSalArray<SalNumber>A zero-based SAL array containing one element index for each dimension.

Returns: SalBoolean. True after accessing the element; false if no array is assigned or its SAL type is not Sys.SAL_VARIANT.

Invalid indices, rank mismatches, and value-conversion errors propagate to the caller.