title: How do I get the result of a method called via delegate handler?
body: <p>The following code is just a homework task, therefore <code>delegate</code> there may look totally meaningless</p>
  <p>So, I have a Hangman game class and it has a method that reads game data from a file. If that file is not found - a method from user code should be called:</p>
  <pre><code> catch (FileNotFoundException)
   {
     exceptionOnLoad?.Invoke(&quot;File doesn't exist&quot;);
   }
  </code></pre>
  <p>So there I have a delegate and a handler method, that assigns a custom user method to it:</p>
  <pre><code>public delegate bool ExceptionErrorHandler(string message);
  private ExceptionErrorHandler? exceptionOnLoad;
  public void RegisterExceptionErrorHandler(ExceptionErrorHandler method)
  {
     exceptionOnLoad = method;
  }
  </code></pre>
  <p>So here's a method from user code that <code>exceptionOnLoad</code> is supposed to call:</p>
  <pre><code>static bool HandleOnErrorMessage(string message)
  {      
     Console.WriteLine(message);
     return true;
  }
  </code></pre>
  <p>It returns bool, because I'd like to use it as an indicator for stopping a Hangman game, but it is called via the following construction and there's nowhere to write that bool value to:</p>
  <pre><code>hangmanGame.RegisterExceptionErrorHandler(HandleOnErrorMessage);
  </code></pre>
  <p>Is there a way to store the bool-result of <code>HandleOnErrorMessage</code> in a variable? Or maybe there's a better way to use <code>delegate</code> and achieve desirable result in this situation?
  I was thinking about this:</p>
  <pre><code>catch (FileNotFoundException)
  {
     bool? load = exceptionOnLoad?.Invoke(&quot;File doesn't exist&quot;);
  }
  </code></pre>
  <p>And then making a file loading method also output this bool, but this seems strange (maybe in vain).</p>