SleepWellPupper
Safely getting a result from a async method within a sync method
Op specified
capture any possible exceptions
async void
does not do that, async Task
does. There is no relevant upside to using async void
over async Task
for this.
ContinueWith
might as well be implemented using async/await37 replies
Safely getting a result from a async method within a sync method
I back my claim with official advice:
https://learn.microsoft.com/en-us/archive/msdn-magazine/2013/march/async-await-best-practices-in-asynchronous-programming#avoid-async-void
37 replies
Safely getting a result from a async method within a sync method
make it async voidThere is absolutely no need for this in the code OP shared; this is genuinely bad advice. Unless you are writing event handlers for a UI framework dictating a void returning handler, you should not use
async void
.37 replies
Java to C#
That depends on what you mean by backend.
Generally, it is possible to interop Java and C# by transpiling jar files to dlls using ikvm, a jvm for dotnet.
https://github.com/ikvmnet/ikvm
11 replies
Safely getting a result from a async method within a sync method
The best advice in most cases is to make your calling method async.
See here : https://blog.stephencleary.com/2012/07/dont-block-on-async-code.html
for an explanatikn
37 replies
Dictionary<> Keys do not get fetched properly
Implementing an EqualityComparer seems unnecessary to me in this case.
Tip for OP: in VS you can generate GetHashCode and Equals implementations using the quick actions context menu when opened on the type name (put caret in type name, press ctrl+. then select generate Equals+GetHashCode)
13 replies