PowerArgs.ContextAssistSearch.Search C# (CSharp) Method

Search() public method

Performs a standalone search and cleans up the menu at the end.
public Search ( IConsoleProvider console = null, bool allowCancel = true ) : ContextAssistSearchResult
console IConsoleProvider Optionally choose a custom console target
allowCancel bool if true, users can cancel the search by pressing the escape key. If false, the escape key does nothing.
return ContextAssistSearchResult
        public ContextAssistSearchResult Search(IConsoleProvider console = null, bool allowCancel = true)
        {
            console = console ?? ConsoleProvider.Current;
            using (var snapshot = console.TakeSnapshot())
            {
                try
                {
                    DoSearchInternal(null, console, allowCancel);
                    return SelectedValue;
                }
                catch (OperationCanceledException)
                {
                    return null;
                }
                finally
                {
                    ClearMenu(null);
                }
            }
        }