Linked Questions

42 votes
2 answers
44k views

In a windows 8 application in C#/XAML, I sometimes want to call an awaitable method from a non asynchronous method. Actually is it correct to replace this : public async Task<string> ...
Thomas Salandre's user avatar
33 votes
3 answers
50k views

I'm building a Metro App. In the MainPage.xaml.cs, I instantiate Album as follows: Album album = new Album(2012); //With the album ID as its parameter. ListView1.ItemsSource = album.Songs; In the ...
Isilmë O.'s user avatar
  • 1,756
25 votes
2 answers
55k views

I have the below method: public string RetrieveHolidayDatesFromSource() { var result = this.RetrieveHolidayDatesFromSourceAsync(); /** Do stuff **/ var returnedResult = ...
Samuel Tambunan's user avatar
12 votes
1 answer
38k views

I know some people will argue "why don't you just make SyncMethod() to async method?". We wish, but in a real world, sometimes we have to keep SyncMethod the way it is for backwards ...
Jonas T's user avatar
  • 3,095
1 vote
3 answers
5k views

Consider this code: public async Task DoStuffAsync() { await WhateverAsync(); // Stuff that might take a while } // Elsewhere in my project... public async Task MyMethodAsync() { await ...
BG100's user avatar
  • 4,541
5 votes
1 answer
1k views

To be clearer, I am referencing a factory method that did not used to be async. In a recent API upgrade, they made the old method obsolete and created a new async method. Now, our code base is ...
C. Williamson's user avatar
0 votes
1 answer
2k views

Is there a way where we can return TaskHttpResponseMessage type to HttpResponseMessage type?Below is the code. private HttpResponseMessage Process(string receiver,HttpRequestMessage request) ...
TechnoSavvy's user avatar
2 votes
1 answer
948 views

I have a function that isn't async and as a result I can't use await. In that function I call a function that's async. My coworker suggested I use: private void Foo() { var _ = BarAsync(); } This ...
Christian's user avatar
  • 26.5k
0 votes
0 answers
885 views

I'm trying to call an async Task method, from another class. The method is place within a service I have created. Service: public class GetRoomsService { public async Task<...
Mikkel's user avatar
  • 1,811
0 votes
0 answers
321 views

I'm building an app using an existing codebase that is not async-based. I'm wondering if it's practical to reuse this code or if I need to create async versions of the existing codebase. Here is an ...
Jay's user avatar
  • 1
0 votes
1 answer
145 views

I have a sync method as below: public ActionResult Insert([FromBody] Model model) { } and I also have an async method: _myMethodAsync(); My async method returns int. If I do like this I have to edit ...
Celal Sunnetci's user avatar
1 vote
0 answers
146 views

All the 3rd partly API calls now use Async methods. I do not want to use them async. I want to convert them to syncronous because I do not care about a few seconds, and I can not seem to do async all ...
Luke's user avatar
  • 344
0 votes
0 answers
114 views

I've read so many posts on this, some of which are conflicting (possibly due to the age of the posts), so I just want to confirm my understanding of "best practices" as of .NET 4.8. For an async ...
DrGriff's user avatar
  • 4,934
1 vote
0 answers
92 views

Suppose I had an async method like public async Task<bool> GetBoolAsync() { // Do some stuff return await GetMyBoolFromSomeFunction(somestuff); } and I wanted a synchronous version, ...
jo phul's user avatar
  • 667
0 votes
0 answers
49 views

I'm working with async-await methods and I can't get next functionality: I have a sync wrapper method (MethodSync) that calls an async method (MethodA_Async) and then does some stuff (MethodB). ...
cap29's user avatar
  • 1,026

15 30 50 per page
1
2 3 4 5
11