Skip to content

Latest commit

 

History

History
35 lines (21 loc) · 652 Bytes

IntroSetupCleanupTarget.md

File metadata and controls

35 lines (21 loc) · 652 Bytes
uid
BenchmarkDotNet.Samples.IntroSetupCleanupTarget

Sample: IntroSetupCleanupTarget

Sometimes it's useful to run setup or cleanups for specific benchmarks. All four setup and cleanup attributes have a Target property that allow the setup/cleanup method to be run for one or more specific benchmark methods.

Source code

[!code-csharpIntroSetupCleanupTarget.cs]

THe order of method calls

// GlobalSetup A

// Benchmark A

// GlobalSetup B

// Benchmark B

// GlobalSetup B

// Benchmark C

// Benchmark D

See also

  • @docs.setup-and-cleanup