public void demonstrate_user_defined_detector_usage() { DetectorFactory.RegisterDetector(typeof(ROfXDetectorInput), typeof(ROfXDetector)); var detectorInput = new ROfXDetectorInput { TallyType = "ROfX", Name = "My First R(x) Detector", TallySecondMoment = true, X = new DoubleRange(0, 10, 101), }; var simInput = new SimulationInput { DetectorInputs = new[] { detectorInput }, N = 100, }; var sim = simInput.CreateSimulation(); var results = sim.Run(); IDetector detector; var detectorExists = results.ResultsDictionary.TryGetValue(detectorInput.Name, out detector); Assert.IsTrue(detectorExists); var firstValue = ((ROfXDetector)detector).Mean.FirstOrDefault(); Assert.IsTrue(firstValue != 0); DetectorIO.WriteDetectorToFile(detector, "user_defined_detector"); var deserializedDetector = DetectorIO.ReadDetectorFromFile("user_defined_detector", ""); }