Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6145069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:44:34+00:00 2026-05-23T18:44:34+00:00

I am used to Javascript where I can simply pass a function as a

  • 0

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.

Now I am writing an app in c# and would like to accomplish the same thing.

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?

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?:

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

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T18:44:35+00:00Added an answer on May 23, 2026 at 6:44 pm

    There are no synchronous web calls in silverlight / wp7, so that is not a restsharp problem.

    As arthur said you want delegates.

    function getData(Action<string> callback) {
      if (token.needRefresh) {
        refrshToken(() => getData(callback) );
        return;
      }
      // get Data
      callback(data);
    }
    
    function refreshToken(Action callback) {
      // token.refresh
      callback();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

which javascript framework can be used for all browsers
How can I tell in JavaScript what path separator is used in the OS
Is there any javascript algo that i can used to check for a website
In JavaScript, can (?=regex) and (?!regex) be used in the middle of a regular
I have used Javascript onlaod like this: function check() { var pic = new
Im trying to find the location of a JavaScript Function that is being used
I have been writing javascript for one or two months , I never used
I am very new at jQuery ... I've used Javascript many times and am
I am looking get to grips with functional programming concepts. I've used Javascript for
I know ClientID is used for javascript and UniqueId for server side and that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.