﻿---
title: Parameters and binding
description: Method parameters become CLI flags automatically. No attribute boilerplate for the common case. Nullean.Argh supports several parameter binding modes:...
url: https://docs-v3-preview.elastic.dev/argh/parameters
---

# Parameters and binding
Method parameters become CLI flags automatically. No attribute boilerplate for the common case.

## Overview

Nullean.Argh supports several parameter binding modes:
- **[Flags](https://docs-v3-preview.elastic.dev/argh/parameters/flags)** - named options (`--output-dir ./bin`), derived from C# parameter names
- **[Arguments](https://docs-v3-preview.elastic.dev/argh/parameters/arguments)** - positional parameters (`myapp deploy production`), marked with `[Argument]`
- **[DTO binding](https://docs-v3-preview.elastic.dev/argh/features/dto-binding)** - expand records/classes into individual flags with `[AsParameters]`
- **[Custom parsers](https://docs-v3-preview.elastic.dev/argh/parameters/custom-parsers)** - `IArgumentParser<T>` for types with no built-in support
- **[Validation](https://docs-v3-preview.elastic.dev/argh/features/validation)** - DataAnnotations and filesystem path attributes


## Supported types


| Category    | Types                                                                  |
|-------------|------------------------------------------------------------------------|
| Primitives  | `string`, `int`, `long`, `double`, `float`, `decimal`, `bool`, `bool?` |
| System      | `enum`, `FileInfo`, `DirectoryInfo`, `Uri`                             |
| Collections | `List<T>`, `T[]`                                                       |


### Collections

Collection flags accept the flag multiple times by default. Use `[CollectionSyntax(Separator=",")]` for comma-separated input instead. For variadic positionals, use `[Argument] T[]` or `[Argument] params T[]`.
```csharp
public static Task<int> Deploy(string[] targets) { … }
```

```
myapp deploy --targets web --targets api
```

```csharp
public static Task<int> Deploy([CollectionSyntax(Separator = ",")] string[] tags) { … }
```

```
myapp deploy --tags blue,green
```


## How it works

The source generator reads your method signatures at build time and emits typed parsers for each parameter. Parameter names are converted from camelCase to kebab-case for CLI flags.
Parameters with default values are optional; those without are required.