> For the complete documentation index, see [llms.txt](https://gabriel-schade-cardoso.gitbook.io/tango/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gabriel-schade-cardoso.gitbook.io/tango/modules/option/tolist.md).

# ToList

Convert the `Option<T>` to a `List<T>` of length 0 or 1.

| Parameters        | Returns  |
| ----------------- | -------- |
| Option\<T> option | List\<T> |

## Usage

Returns a `List<T>` with a single element when the option value `IsSome`. Otherwise returns an empty collection.

&#x20;**When option IsSome**&#x20;

```csharp
Option<int> optionValue = 42;
List<int> result = optionValue.ToList();

//result = [ 42 ]
```

&#x20;**When option IsNone**&#x20;

```csharp
Option<int> optionValue = Option<int>.None();
List<int> result = optionValue.ToList();

//result = []
```
