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 1254 karma points c-trib
    Aug 30, 2018 @ 11:06
    John Churchley

    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 3160 posts 10395 karma points MVP 3x admin c-trib
    Aug 30, 2018 @ 12:02
    Dave Woestenborghs

    Hi John,

    I think you can do this ;

    var result= AsyncMethod().Result;


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

    Thanks Dave,

    Really close I end up doing

    var result = Task.Run(() => method()).Result;
Please Sign in or register to post replies

Write your reply to: