Skip to content

Commit

Permalink
dotnet#658: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gsomix committed Oct 13, 2018
1 parent 0f8619f commit 3e49099
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/articles/features/parameterization.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ name: Benchmark Parameterization

[!include[IntroParamsSource](../samples/IntroParamsSource.md)]

[!include[IntroParamsAllValues](../samples/IntroParamsAllValues.md)]

[!include[IntroArguments](../samples/IntroArguments.md)]

[!include[IntroArgumentsSource](../samples/IntroArgumentsSource.md)]
Expand Down
42 changes: 42 additions & 0 deletions docs/articles/samples/IntroParamsAllValues.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
uid: BenchmarkDotNet.Samples.IntroParamsAllValues
---

## Sample: IntroParamsAllValues

If you want to use all possible values of an `enum` or another type with a small number of values, you can use the [`[ParamsAllValues]`](xref:BenchmarkDotNet.Attributes.ParamsAllValuesAttribute) attribute, instead of listing all the values by hand. The types supported by the attribute are:

* `bool`
* any `enum` that is not marked with `[Flags]`
* `Nullable<T>`, where `T` is a supported type

### Source code

[!code-csharp[IntroParamsAllValues.cs](../../../samples/BenchmarkDotNet.Samples/IntroParamsAllValues.cs)]

### Output

```markdown
Method | E | B | Mean | Error |
---------- |---- |------ |---------:|------:|
Benchmark | A | ? | 101.9 ms | NA |
Benchmark | A | False | 111.9 ms | NA |
Benchmark | A | True | 122.3 ms | NA |
Benchmark | BB | ? | 201.5 ms | NA |
Benchmark | BB | False | 211.8 ms | NA |
Benchmark | BB | True | 221.4 ms | NA |
Benchmark | CCC | ? | 301.8 ms | NA |
Benchmark | CCC | False | 312.3 ms | NA |
Benchmark | CCC | True | 322.2 ms | NA |

// * Legends *
E : Value of the 'E' parameter
B : Value of the 'B' parameter
```

### Links

* @docs.parameterization
* The permanent link to this sample: @BenchmarkDotNet.Samples.IntroParamsAllValues

---

0 comments on commit 3e49099

Please sign in to comment.