# 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`](/unity/api/mlfeaturetype.md) 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.natml.ai/unity/api/mlfeaturetype/mlarraytype.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
