# MLArrayType

This feature type describes multidimensional arrays or tensors.

## Creating the Type

```csharp
/// <summary>
/// Create an array feature type.
/// </summary>
/// <param name="type">Array element type.</param>
/// <param name="shape">Array feature shape.</param>
MLArrayType (Type type, int[] shape);
```

An array type is created with a data type and a corresponding shape.

{% hint style="info" %}
Even though array types can be created without a `shape`, this should be avoided.
{% endhint %}

There is another constructor which accepts a feature name:&#x20;

```csharp
/// <summary>
/// Create an array feature type.
/// </summary>
/// <param name="name">Feature name.</param>
/// <param name="type">Array element type.</param>
/// <param name="shape">Array feature shape.</param>
MLArrayType (string name, Type type, int[] shape);
```

## Inspecting the Type

```csharp
/// <summary>
/// Feature name.
/// </summary>
string name { get; }

/// <summary>
/// Feature data type.
/// This will typically be a numeric type.
/// </summary>
Type dataType { get; }
```

Refer to the [`MLFeatureType`](https://docs.natml.ai/unity/api/mlfeaturetype) class for more information.

## Inspecting the Shape

```csharp
/// <summary>
/// Array shape.
/// </summary>
int[] shape { get; }
```

The array type provides the shape of its corresponding feature.&#x20;

### Dimensions

```csharp
/// <summary>
/// Array dimensions.
/// </summary>
int dims { get; }
```

The type provides a convenience property for the number of dimensions which the array feature has.

{% hint style="info" %}
This is always the number of elements in the `shape`.
{% endhint %}

### Element Count

```csharp
/// <summary>
/// Array element count.
/// </summary>
int elementCount { get; }
```

The type provides a convenience property for the number of elements which the array feature has.

{% hint style="info" %}
This is always the product of the elements in the `shape`.
{% endhint %}
