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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:10:29+00:00 2026-06-15T12:10:29+00:00

for (int j = 0; j < 10; j++) { for (long i =

  • 0
for (int j = 0; j < 10; j++)
{
    for (long i = 0; i < bound / 10; i++)
    {
        routeLine.Locations.Add(new Location
        {
            Latitude = ((BingMapsRESTService.Route)(r.ResourceSets[0].Resources[0])).RoutePath.Line.Coordinates[k][0],
            Longitude = ((BingMapsRESTService.Route)(r.ResourceSets[0].Resources[0])).RoutePath.Line.Coordinates[k][1]
        });

        k++;
    }

    await Task.Delay(TimeSpan.FromMilliseconds(1));

    Temp("Drawing Route (" + ((j * 10)/2).ToString() + "%)"); // to show progress,Temp sets text property of a textbox
}

Bound has value between 6000 to 10000. This loop takes time and hang the UI that’s why i divided the loop into 10 parts and used task.delay.
Is it possible to run all ten loops in parallel? I can’t use thread as I can’t create object of Location class in new thread. It throws an error of task being marshaled by some another thread

  • 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-15T12:10:30+00:00Added an answer on June 15, 2026 at 12:10 pm

    Yes it is possible; you can use TPL and Parallel.ForEach:

    TPL

    Parallel.ForEach

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

Sidebar

Related Questions

SAFEARRAYBOUND bound[1] = {25, 0}; SAFEARRAY * psa = SafeArrayCreate(VT_UI1, 1, bound); for(long int
In c, are primitive data types such as int long char unsigned... all macros?
I managed to get a unsigned long int octets-representation (BE) by reading IPv4 methods,
symbol.c: In function 'symbol_FPrint': symbol.c:1209: warning: format '%ld' expects type 'long int', but argument
Here's an example I have. public int getDelta() { long time = getTime(); int
#include <limits.h> #include <stdio.h> int main() { long ival = 0; printf(ival: %li, min:
#include<stdio.h> #include<time.h> int main() { clock_t start; double d; long int n,i,j; scanf(%ld,&n); n=100000;
Short problem: #include <iostream> using namespace std; int main() { double **T; long int
How do encrypt/decrypt a long or int using the Bouncy Castle crypto routines for
Why is this code throwing up a SIGSEGV : int main() { unsigned long

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.