title: Callback Functions in C#
body: <p>I am used to Javascript where I can simply pass a function as a parameter to use as a callback later. It was nice and easy.</p>
  
  <p>Now I am writing an app in c# and would like to accomplish the same thing. </p>
  
  <p>Basically, my app is like the following and requires an authentication token. However, at the getData stage, if the token is expired, I need to call refreshToken(). How do I pass the callback function through refreshToken() so getData knows what to call when the token is refreshed?</p>
  
  <p>Here's a diagram of what I would do in Javascript, but would I go about doing this in C#, or just passing callbacks in general?:</p>
  
  <pre><code>getData(callback);
  // Looks like the token is expired, exiting the getData function and refreshing token
  refreshToken(function(){ getData(callback); });
  // Token is refreshed, now call getData()
  getData(callback);
  // Callback is run
  </code></pre>
  
  <p>Or, alternatively, instead of using a ton of callbacks I could do the refreshToken call synchronously. However, RestSharp on WP7 for whatever reason isn't showing Execute, just ExecuteAsync, which is what I use now. Does anyone know why this method doesn't seem to exist for me?</p>