Skip to content

Commit 3f4e84f

Browse files
committed
Add docs/samples
1 parent 70e7867 commit 3f4e84f

9 files changed

+144
-1
lines changed

docs/articles/configs/hidecolumns.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
uid: docs.hidingcolumns
3+
name: Hide columns
4+
---
5+
6+
# Hiding Columns
7+
8+
You can hide columns in a table in the following ways:
9+
10+
---
11+
12+
[!include[IntroHideColumnsAttr](../samples/IntroHideColumnsAttr.md)]
13+
14+
[!include[IntroHideColumnsConfig](../samples/IntroHideColumnsConfig.md)]
15+
16+
[!include[IntroHideColumnsCustomRule](../samples/IntroHideColumnsCustomRule.md)]

docs/articles/configs/toc.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@
2121
- name: Orderers
2222
href: orderers.md
2323
- name: ConfigOptions
24-
href: configoptions.md
24+
href: configoptions.md
25+
- name: Hiding Columns
26+
href: hidingcolumns.md
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
uid: BenchmarkDotNet.Samples.IntroHideColumnsAttr
3+
---
4+
5+
## Sample: IntroHideColumnsAttr
6+
7+
### Source code
8+
9+
[!code-csharp[IntroHideColumnsAttr.cs](../../../samples/BenchmarkDotNet.Samples/IntroHideColumnsAttr.cs)]
10+
11+
### Links
12+
13+
* @docs.hidingcolumns
14+
* The permanent link to this sample: @BenchmarkDotNet.Samples.IntroHideColumnsAttr
15+
16+
---
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
uid: BenchmarkDotNet.Samples.IntroHideColumnsConfig
3+
---
4+
5+
## Sample: IntroHideColumnsConfig
6+
7+
### Source code
8+
9+
[!code-csharp[IntroHideColumnsConfig.cs](../../../samples/BenchmarkDotNet.Samples/IntroHideColumnsConfig.cs)]
10+
11+
### Links
12+
13+
* @docs.hidingcolumns
14+
* The permanent link to this sample: @BenchmarkDotNet.Samples.IntroHideColumnsConfig
15+
16+
---
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
uid: BenchmarkDotNet.Samples.IntroHideColumnsCustomRule
3+
---
4+
5+
## Sample: IntroHideColumnsCustomRule
6+
7+
### Source code
8+
9+
[!code-csharp[IntroHideColumnsCustomRule.cs](../../../samples/BenchmarkDotNet.Samples/IntroHideColumnsCustomRule.cs)]
10+
11+
### Links
12+
13+
* @docs.hidingcolumns
14+
* The permanent link to this sample: @BenchmarkDotNet.Samples.IntroHideColumnsCustomRule
15+
16+
---

docs/articles/samples/toc.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@
5454
href: IntroGenericTypeArguments.md
5555
- name: IntroHardwareCounters
5656
href: IntroHardwareCounters.md
57+
- name: IntroHideColumnsAttr
58+
href: IntroHideColumnsAttr.md
59+
- name: IntroHideColumnsConfig
60+
href: IntroHideColumnsConfig.md
61+
- name: IntroHideColumnsCustomRule
62+
href: IntroHideColumnsCustomRule.md
5763
- name: IntroInliningDiagnoser
5864
href: IntroInliningDiagnoser.md
5965
- name: IntroInProcess
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using BenchmarkDotNet.Attributes;
2+
using BenchmarkDotNet.Rules;
3+
4+
namespace BenchmarkDotNet.Samples
5+
{
6+
[HideColumns(Column.Mean, Column.Error)]
7+
[HideColumns("StdDev", "N")]
8+
public class IntroHideColumns
9+
{
10+
[Params(1, 2)] public int N;
11+
12+
[Benchmark]
13+
public void Test() { }
14+
}
15+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using BenchmarkDotNet.Attributes;
2+
using BenchmarkDotNet.Columns;
3+
using BenchmarkDotNet.Configs;
4+
using BenchmarkDotNet.Rules;
5+
using BenchmarkDotNet.Running;
6+
7+
namespace BenchmarkDotNet.Samples
8+
{
9+
public class IntroHideColumnsFluentConfig
10+
{
11+
public static void Run()
12+
{
13+
BenchmarkRunner.Run<Benchmark>(
14+
DefaultConfig.Instance
15+
.HideColumns(Column.Mean, Column.Error)
16+
.HideColumns("StdDev", "N"));
17+
}
18+
19+
public class Benchmark
20+
{
21+
[Params(1, 2)] public int N;
22+
23+
[Benchmark]
24+
public void Test() { }
25+
}
26+
}
27+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using BenchmarkDotNet.Attributes;
2+
using BenchmarkDotNet.Columns;
3+
using BenchmarkDotNet.Configs;
4+
using BenchmarkDotNet.Rules;
5+
using BenchmarkDotNet.Running;
6+
7+
namespace BenchmarkDotNet.Samples
8+
{
9+
public class StatisticColumnHidingRule : IColumnHidingRule
10+
{
11+
public bool NeedToHide(IColumn column) => column.Category == ColumnCategory.Statistics;
12+
}
13+
14+
public class IntroHideColumnsByCustomRule
15+
{
16+
public static void Run()
17+
{
18+
BenchmarkRunner.Run<Benchmark>(
19+
DefaultConfig.Instance.HideColumns(new StatisticColumnHidingRule()));
20+
}
21+
22+
[AllStatisticsColumn]
23+
public class Benchmark
24+
{
25+
[Benchmark]
26+
public void Test() { }
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)