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

  • SEARCH
  • Home
  • 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 6725909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:51:47+00:00 2026-05-26T09:51:47+00:00

I have WCF connector that should get some small amount of data for me,

  • 0

I have WCF connector that should get some small amount of data for me, usually it takes up to 20 seconds to get this data for each item ( which is fine ). I want to use Task to get data for me and then add WinForm controls with value from this Tasks.

I’ve created list of objects which will consist this data.

Used first Task as the one which updates the list and i want Task that is right away after first Task is done to create controls.

This is the code so far:

List<IpVersionCounter> ipVersionCounters = new List<IpVersionCounter>();
Task task = Task.Factory.StartNew(() =>
{
   foreach (var sitein settings.Sites)
   {
       string ip = site.ip;
       string version = "undefined";

       using (WcfConnector wcfConnector = 
                    WcfConnector.CreateConnectorWithoutException((ip)))
       {
           if (wcfConnector != null)
           {
               version= string.Format("{0} {1} {2}", 
               wcfConnector.VersionController.GetBranchName(), 
               wcfConnector.VersionController.GetBuildNumber(),
               wcfConnector.VersionController.GetCurrentVersion());
           }
       }
       counter++;
       ipVersionCounters.Add(new IpVersionCounter
                            {
                            Ip = ip,
                            Version = Version,
                            Counter = counter
                            });
    }
return ipVersionCounters;
}).ContinueWith();

AddProgressBar(ipVersionCounter);

I don’t know if i’m going right way and how to use ContinueWith to pass value from first method to second.

  • 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-26T09:51:48+00:00Added an answer on May 26, 2026 at 9:51 am

    In the example below previousTask references the previous task, use the Result property to get the return value from it.

    Task task = Task.Factory.StartNew(() =>
    {
       // Background work
       return ipVersionCounters;
    }).ContinueWith((previousTask) => 
    {
       var ipVersionCounters = previousTask.Result;
    });
    

    Update

    If you want the continuewith to execute on the UI thread use (If you are starting on the UI thread) …

    Task.Factory.StartNew(() =>
    {
      // Background work
    }).ContinueWith((previousTask) => {
      // Update UI thread
    }, TaskScheduler.FromCurrentSynchronizationContext());
    

    (which was taken from this answer for more info)

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

Sidebar

Related Questions

I have a WCF service that accesses a SQL database to fetch data .
I have a WCF service that uses ODP.NET to read data from an Oracle
I have a WCF webservice that acts as a data provider for my ASP.NET
I have a plugin that exposes a wcf service. if I test this service
I have created a class library that should connect to a WCF endpoint project
I have a client application that connects to a WCF service, I get the
I have a WCF service that I am attempting to connect to via a
I have a Linux/c client app that connects to a WCF web service over
I have a mobile app webservice client that connects to a WCF webservice(on my
I would create a WCF service with some methods. One of these methods (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.