# FastListCore<T>

配列と使用中の件数を分けて管理するリストです。AsSpanは使用中の範囲、AsArrayは確保済み配列を返します。

Namespace: MeatMotion.Collections

Assembly: MeatMotion

```csharp
public struct FastListCore<T>
```

[Runtime/Collections/MotionCollections.cs · L7](../../source/Runtime/Collections/MotionCollections.cs.html#L7)

## Empty

要素を持たない既定のリストです。

```csharp
public static readonly FastListCore<T> Empty;
```

[Runtime/Collections/MotionCollections.cs · L13](../../source/Runtime/Collections/MotionCollections.cs.html#L13)

## Length

配列のうち使用中の要素数を取得します。

```csharp
public readonly int Length { get; }
```

[Runtime/Collections/MotionCollections.cs · L16](../../source/Runtime/Collections/MotionCollections.cs.html#L16)

## this

内部配列の指定位置の値を読み書きします。呼び出し側でLength未満のインデックスを使ってください。

```csharp
public readonly T this[int index] { get; set; }
```

[Runtime/Collections/MotionCollections.cs · L17](../../source/Runtime/Collections/MotionCollections.cs.html#L17)

## AsSpan

使用中の要素だけを含むSpanを返します。

```csharp
public readonly Span<T> AsSpan()
```

戻り値

- 戻り値: `Span<T>`

[Runtime/Collections/MotionCollections.cs · L18](../../source/Runtime/Collections/MotionCollections.cs.html#L18)

## AsArray

未使用の容量も含む内部配列を返します。

```csharp
public readonly T[] AsArray()
```

戻り値

- 戻り値: `T[]`

[Runtime/Collections/MotionCollections.cs · L19](../../source/Runtime/Collections/MotionCollections.cs.html#L19)

## EnsureCapacity

指定した件数以上の要素を保持できるように配列を予約します。

```csharp
public void EnsureCapacity(int capacity)
```

引数

- `capacity` (`int`) 事前に確保する要素数。

[Runtime/Collections/MotionCollections.cs · L21](../../source/Runtime/Collections/MotionCollections.cs.html#L21)

## Add

末尾に要素を追加します。空きがなければ配列を拡張します。

```csharp
public void Add(T element)
```

引数

- `element` (`T`) 末尾に追加する要素。

[Runtime/Collections/MotionCollections.cs · L29](../../source/Runtime/Collections/MotionCollections.cs.html#L29)

## RemoveAtSwapback

削除した位置へ末尾の要素を移します。要素順は変わります。

```csharp
public void RemoveAtSwapback(int index)
```

引数

- `index` (`int`) 操作する要素のインデックス。

[Runtime/Collections/MotionCollections.cs · L35](../../source/Runtime/Collections/MotionCollections.cs.html#L35)

## Clear

要素を消去して件数を0にします。removeArrayを指定すると配列への参照も解放します。

```csharp
public void Clear(bool removeArray = false)
```

引数

- `removeArray = false` (`bool`) trueで使用中の要素と内部配列の両方を解放します。

[Runtime/Collections/MotionCollections.cs · L42](../../source/Runtime/Collections/MotionCollections.cs.html#L42)
