If an experiment requires expensive setup that should only occur when the experiment is going to be run, define it with the BeforeRun method:
BeforeRun
public int DoSomethingExpensive() { return Scientist.Science<int>("expensive-but-worthwile", experiment => { experiment.BeforeRun(() => ExpensiveSetup()); experiment.Use(() => TheOldWay()); experiment.Try(() => TheNewWay()); }); }
There was an error while loading. Please reload this page.
Sometimes scientists just gotta do weird stuff. We understand.