Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • John Churchley 272 posts 1257 karma points c-trib
    Aug 30, 2018 @ 11:06
    John Churchley
    0

    Async Methods TreeController

    I'm need to call an async method which calls an external API inorder to obtain the data for tree.

    TreeController requires the following method

    protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)

    How do I get around the method is synchronous return type?

  • Dave Woestenborghs 3325 posts 11170 karma points MVP 5x admin c-trib
    Aug 30, 2018 @ 12:02
    Dave Woestenborghs
    0

    Hi John,

    I think you can do this ;

    var result= AsyncMethod().Result;
    

    Dave

  • John Churchley 272 posts 1257 karma points c-trib
    Sep 13, 2018 @ 13:31
    John Churchley
    100

    Thanks Dave,

    Really close I end up doing

    var result = Task.Run(() => method()).Result;
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies