> 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/collection/pick.md).

# Pick

Applies the given `chooser` function to successive elements, returning the first result where function returns an option value that `IsSome`.

It works similar to [`Choose`](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Modules/Collection/choose.html) function, but in this case only the first value is returned.

| Parameters                                                        | Returns |
| ----------------------------------------------------------------- | ------- |
| <p>Func\<T, Option\<T2>> chooser</p><p>IEnumerable\<T> source</p> | T2      |

## Exceptions

| Type                      | When                                                               |
| ------------------------- | ------------------------------------------------------------------ |
| InvalidOperationException | The chooser function returns options with IsNone for all elements. |

## Usage

&#x20;**Getting the double of first odd number in a collection**&#x20;

```csharp
//IEnumerable<int> source = { 2, 2, 4, 4, 6, 6, 7, 8, 9 }

int result = source.Pick(value => 
            {
                if(value % 2 == 1)
                    return value * 2;
                else
                    return Option<int>.None();
            });

//result = 14
```
