title: Understanding delegates and Events in C# using a specific example
body: <p>So I'm at the point of understanding events and delegates.</p>
  
  <p>I overally understand the usage of delegates.
  The only thing that concerns me about delegates is whether a delegate can be configured to work with functions that are not related to events in any way... <strong>if yes, how do I write the logic for a delegate-defined function?</strong> (I guess such function doesn't really have much of a point to it, but it's good to know.)</p>
  
  <p>As for events... I'm having a hard time understanding it. I get the idea that an event is a function that gets executed when something happens in the code.
  However, I don't get the process of creating an event. Partially.</p>
  
  <p>For this question I'll use an answer by <strong>Gary Willoughby</strong>: <a href="https://stackoverflow.com/a/803528/1104766">https://stackoverflow.com/a/803528/1104766</a> 
  It was posted on a question from which I tried to understand this whole subject.</p>
  
  <p>What I didn't get in the example above:<br>
  <code>MyObject.OnMaximum += new MyEventHandler(MaximumReached);</code><br>
  First, <strong>how can you create an instance of a delegate, and pass it only 1 variable when it requires 2?</strong> There must be something I'm missing...<br>
  The second thing about this line is that the <code>new ...()</code> instance is being <strong>added</strong> to the <code>OnMaximum</code> function that resides in <code>MyObject</code> which is an instance of <code>MyClass</code> - <strong>what exactly is <code>OnMaximum</code> if such thing can be done?</strong> It was never really defined too!</p>
  
  <pre><code>      if(OnMaximum != null) {
          OnMaximum(this, new MyEventArgs("You've entered " +
            value.ToString() +
            ", but the maximum is " +
            Maximum.ToString()));
        }
  </code></pre>
  
  <p>As for this part, <code>OnMaximum</code> is called but it's logic was never really defined anywhere in the code, so what could be the outcome? Obviously I'd guess it'd be the text "You've entered............." but my question is to be more specific, <strong>what really happens with the values the function/event receives?</strong></p>
  
  <p>I marked all of my questions in <strong>BOLD</strong> for clarity.</p>
  
  <p>P.S, I know this question <strong>generally</strong> has been posted a few times.<br>
  Please note that this specific question refers to an answer written by another member and the questions asked here are specific to this example. That's why such answers can't really be found in google.<br>
  For the record though, I did search before I posted, and I did try to understand, but I guess examples are the best way for me to understand something especially when my knowledge of the English CS vocabulary is lacking.</p>