title: How to generate callback (event) from library to application in c#
body: <p>I'm developing one library (DLL), in which I need to provide event (interrupt) to user as one method with data. Library's work is start listing on socket, receive data from socket and pass this data to user in one method.</p>
  
  <p><strong>Library:</strong></p>
  
  <pre><code>public void start(string IP, int port)
  {
      // start logic...
  
      // receives data from socket... send this data to user
  
  }
  </code></pre>
  
  <p><strong>Application:</strong></p>
  
  <pre><code>Library. Class a = new Library. Class();
  a.start(ip, port);
  
  // I need this method called by library automatically when it receives data...
  
  void receivedData(string data)
  {
      // data which received by library....
  }
  </code></pre>
  
  <p>How to raise event to application with data from library? </p>
  
  <p>Thanks in advance....</p>