Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Web Service Threading and State

Web Service Threading and State

Scheduled Pinned Locked Moved C#
helplearning
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    il_manti
    wrote on last edited by
    #1

    Hi all, I have an issue and I'd like to find a cleaner solution (as, right now, my work around is dirty beyond recognition ;P ). This is the structure "Search" (A web service method) is called by Web Site "Search" calls two other Web Service methods Asynchronously Each Async method calls a "Completed" method (one each) and each "Completed" method checks if the other one was finished before it Once both Async calls have been finished another method ("Connect Results") is called by the last finished "Completed" method "Connect Results" gathers data from two files (saved from each async method) and joins them into one instance of a class "Final Result" which needs to be returned BUT since the method "Search" needs a return and because the return line is reached before any of the threads have finished executing, the return is always empty. So I inserted a while loop (which checks that "Final Result" is not empty) before the last "return" line of "Search" which does nothing except wait for the class to be filled! I'm sure there's some other way to do this... something cleaner but I can't seem to find it. Thanks for your help and sorry for the long post...

    In life truth does not matter. What really matters is what others believe to be the truth. (The Up and Comer - Book)

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups