title: Passing a callback function to another class
body: <p>I'm basically trying to pass a method to another class to be called later, but can't quite figure this out in C# (I'm still too used to Objective-C).</p>
  
  <pre><code>public class Class1{
  
      private void btn_click(object sender, EventArgs e)
      {
          ServerRequest sr = new ServerRequest();
          sr.DoRequest("myrequest", myCallback);
      }
  
      public void myCallback(string str)
      {
      }
  }
  </code></pre>
  
  <p>Then later on I want my ServerRequest class to basically fire the callback function, is this not possible? (I'm basically phoning home to a server for a login response to my software)</p>
  
  <p>I haven't been able to find a way to do this with delegates, continuously get errors.  Here is the other class:</p>
  
  <pre><code>public class ServerRequest
  {
      public void DoRequest(string request, Delegate callback)
      {
          // do stuff....
          callback("asdf");
      }
  }
  </code></pre>
  
  <p>Is this possible in #?  In Objective-C this would be simple and I would just do something like </p>
  
  <pre><code>[myObject performSelector(@selector(MyFunctionName)) withObjects:nil];
  </code></pre>