ILNumerics Ultimate VS

ExtensionMethodsIsTypeOfCellT Method (ConcreteArrayBaseArray, Cell, InCell, OutCell, RetCell, CellStorage, Int64, Int64, Int64, Int64)

ILNumerics Ultimate VS Documentation
ILNumerics - Technical Application Development
Tests if a cell element is of the given element type.

[ILNumerics Core Module]

Namespace:  ILNumerics
Assembly:  ILNumerics.Core (in ILNumerics.Core.dll) Version: 5.5.0.0 (5.5.7503.3146)
Syntax

public static bool IsTypeOf<CellT>(
	this ConcreteArray<BaseArray, Cell, InCell, OutCell, RetCell, CellStorage> A,
	long d0,
	long d1,
	long d2,
	long d3
)

Parameters

A
Type: ILNumerics.Core.ArraysConcreteArrayBaseArray, Cell, InCell, OutCell, RetCell, CellStorage
The cell.
d0
Type: SystemInt64
Dimensional index into dimension #0.
d1
Type: SystemInt64
Dimensional index into dimension #1.
d2
Type: SystemInt64
Dimensional index into dimension #2.
d3
Type: SystemInt64
Dimensional index into dimension #3.

Type Parameters

CellT
The array element type to probe the cell element for.

Return Value

Type: Boolean
true if the element found at the given position is an array of the given element type CellT, false otherwise.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ConcreteArrayBaseArray, Cell, InCell, OutCell, RetCell, CellStorage. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks

The method is helpful in order to inspect the contents of a cell array. If the actual types of cells in the cell array are unknown this function can be used to determine the type of the content of individual cells before attempting to retrieve any values.

In most situations, elements of a cell are arrays of a distinct element type. This element type is given to IsTypeOfCellT(ConcreteArrayBaseArray, Cell, InCell, OutCell, RetCell, CellStorage, InArrayInt64) as typeparameter CellT. That means, in order to find out, if the first cell element stores an array of int cell.IsTypeOf<int>(0) is used.

When testing for Logical arrays Boolean is used for CellT.

In order to test for cell element type CellT can be Cell or BaseArray: cell.IsTypeOf<BaseArray>(0).

[ILNumerics Core Module]

Examples

In the following example a Cell of size 3x2 is created. It stores several array types, among which other cells are stored as elements of the outer cell.

Cell cell1 = cell(size(3, 2), vector<BaseArray>(
                                "first element"
                                , 2.0
                                , cell(arrays: vector<BaseArray>(Math.PI, 100f))
                                , vector<short>(1, 2, 3, 4, 5, 6)
                                , vector<double>(-1.4, -1.5, -1.6 )));

            Console.Out.WriteLine($"cell[0,0] is element type 'string': {cell1.IsTypeOf<string>(0)}");
            Console.Out.WriteLine($"cell[0,0] is element type 'double': {cell1.IsTypeOf<double>(0)}");

            Console.Out.WriteLine($"cell[1,0] is element type 'double': {cell1.IsTypeOf<double>(1,0)}");
            Console.Out.WriteLine($"cell[2,0] is element type 'Cell': {cell1.IsTypeOf<Cell>(2,0)}");

            Console.Out.WriteLine($"cell[0,1] is element type 'short': {cell1.IsTypeOf<short>(0, 1)}");
            Console.Out.WriteLine($"cell[1,1] is element type 'Cell': {cell1.IsTypeOf<Cell>(1, 1)}");
            Console.Out.WriteLine($"cell[2,1] is element type 'double': {cell1.IsTypeOf<double>(2, 1)}");
This gives the following output:
cell[0,0] is element type 'string': True
cell[0,0] is element type 'double': False
cell[1,0] is element type 'double': True
cell[2,0] is element type 'Cell': True
cell[0,1] is element type 'short': True
cell[1,1] is element type 'Cell': True
cell[2,1] is element type 'double': False (element is null.)
See Also

Reference