protected PerformanceWatcher(string name, PerformanceWatcherConfiguration configuration) { if (string.IsNullOrEmpty(name)) throw new ArgumentException("Watcher name can not be empty."); if (configuration == null) { throw new ArgumentNullException(nameof(configuration), "Performance Watcher configuration has not been provided."); } Name = name; _configuration = configuration; }
/// <summary> /// Factory method for creating a new instance of PerformanceWatcher. /// </summary> /// <param name="name">Name of the PerformanceWatcher.</param> /// <param name="configuration">Configuration of PerformanceWatcher.</param> /// <returns>Instance of PerformanceWatcher.</returns> public static PerformanceWatcher Create(string name, PerformanceWatcherConfiguration configuration) => new PerformanceWatcher(name, configuration);
/// <summary> /// Factory method for creating a new instance of PerformanceWatcher with default name of Performance Watcher. /// </summary> /// <param name="configuration">Configuration of PerformanceWatcher.</param> /// <returns>Instance of PerformanceWatcher.</returns> public static PerformanceWatcher Create(PerformanceWatcherConfiguration configuration) => Create(DefaultName, configuration);