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 8468125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:50:44+00:00 2026-06-10T15:50:44+00:00

My question is fairly simple, but I suspect the answer won’t be. In my

  • 0

My question is fairly simple, but I suspect the answer won’t be. In my WP7 app, I am calling a REST web service to GET some data which I deserialize into class objects.

My request method and its AsyncCallBack method live inside a class (an MVVM ViewModel), and are invoked from inside an instance method on the class (LoadData).

The AsyncCallBack deserializes the json retrieved from the web service into an object. I need to add this object to a collection on the class where all of this is taking place – like so:

this.Collection1.Add(retrievedObject); 

Of course, since AsyncCallBack is static, I can’t access the “this” keyword. I also can’t return the retrievedObject to the caller, because the AsyncCallBack has to return void. I realize I’m probably the victim of some basic misunderstanding here. How do I solve this?

Thanks!

  • 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-06-10T15:50:45+00:00Added an answer on June 10, 2026 at 3:50 pm

    Does it have to be static? No.

    The callback doesn’t have to be static, but you are right to be concerned about thread safety. The callback method will be called on a different thread, so if it uses some data that the main thread is also using, you have to synchronise the access to that data.

    Does it have to return void? Yes.

    The callback method can’t return anything to the method that has started the asynchronous task, because that method returns before the task is completed. For the callback method to set that return value, it would have to travel back in time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This should be a fairly simple question to answer, but I am interested to
I actually have a fairly simple question but I'm unable to find an answer
Hey guys, sorry for this probably fairly simple question but I'm starting to get
Fairly simple question I'm hoping but I've not managed to find an answer yet
I am sure this is a fairly simple question to answer, but I am
I believe this is a fairly simple question but it is something I am
A fairly simple question for which I have a guess, but I can't find
This might be a simple question, but I'm fairly new to PHP and am
I'm fairly new to Android programming, so this may be a simple question, but
I have a fairly simple question, however the answer seems to elude me. If

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.