/// <summary> /// Constructs the search engine based on its type. /// </summary> /// <param name="minimumNumber">The minimum number to search for.</param> /// <param name="maximumNumber">The maximum number to search for.</param> private void ConstructSearchEngine(int minimumNumber, int maximumNumber) { if (_searchEngine.GetType() == typeof(BinarySearchEngine)) { _searchEngine = new BinarySearchEngine(minimumNumber, maximumNumber); } }
public static void AddHandler(this ISearchEngine engine, string eventName, Action <SearchEngineEventArgs> action) { var eventInfo = engine.GetType().GetEvent(eventName); eventInfo.AddEventHandler(engine, (SearchEngineEventHandler)(args => { action(args); })); }