title: How Do I expose an event to the caller implement, see code example?
body: <p>The idea here is to allow the caller to implement <code>AfterHTMLPieceHandler</code> for each cycle of the loop, I don't know if it is quite right or it should be an event insted or delegate. Honestly I don't know the difference, but this is another question.</p>
  
  <pre><code>//? Should it be static?
  public static class PageScan
  {
      public delegate string AfterHTMLPieceHandler();
  
      public static string GetHTML(string url)
      {
          HttpWebRequest wRequest = (HttpWebRequest)WebRequest.Create(url);
          wRequest.Method = "GET";
          HttpWebResponse wResponse = (HttpWebResponse)wRequest.GetResponse();
          StreamReader sReader = new StreamReader(wResponse.GetResponseStream());
          string html = sReader.ReadToEnd();
          sReader.Close();
          wResponse.Close();
          sReader.Dispose();
          return html;
      }
  
      public static void GetPiecesOfHtml(string html, string constantHtml)
      {
          while (html.IndexOf("http://portfoliopad.com/images/") &gt; -1)
          {
              // it will retrieve a piece of html given the constantHtml and remove from html in order to break the loop in the end
              //How Do I hit the event for each time one cycle of the loop ends?
          }
      }
  }
  </code></pre>