title: Triggering an event by value change (
body: <p>I'm a beginner in programming and at the moment I'm looking at events. Now the reason I need an event to work is for the following situation: I run a program which gets an int, if that int changes I want to print out said int to the console.</p>
  <p>Pretty basic and I've been looking at stackoverflow examples and looking at youtube tutorials but just can't wrap my head around events because a lot of them use complex examples. I've also looked at the ValueChanged event but I think my issue is understanding the basic event structure (or better the lack of..)</p>
  <p>please find below the premise of the setup.</p>
  <pre><code>static void Main(string[] args)
  {
      int **Number**;
              
      code that results in getting the number from somewhere and assigning it to Number ;
  }
  
    
  </code></pre>
  <p>If I understand correctly, to be able to call the event you need a delegate, so:</p>
  <p>1] declare the event, but I don't really get where in the code I need to do this</p>
  <p><code>public event EventHandler ValueChanged;</code></p>
  <p>2] add a new reference to that delegate (again, don't know where I would do this)</p>
  <p>3] add a method to execute whenever the event is raised (now I'm absolutely lost, but in essence here's where I'd make a method to print out the changed value, e.g.:</p>
  <pre><code>{ 
      int NewValue;
      Console.WriteLine(NewValue); 
  }
   
  </code></pre>
  <p>4] add a subscriber to the event to be able to trigger it?</p>
  <p>My appologies if I'm saying things that don't make sense, but as mentioned I'm an absolute beginner (perhaps biting of more than I can chew, but I believe that's where you grow..)</p>
  <p>Help is appreciated.</p>