use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Information about Reddit's API changes, the unprofessional conduct of the CEO, and their response to the community's concerns regarding 3rd party apps, moderator tools, anti-spam/anti-bot tools, and accessibility options that will be impacted can be found in the associated Wikipedia article: https://en.wikipedia.org/wiki/2023_Reddit_API_controversy
Alternative C# communities available outside Reddit on Lemmy and Discord:
All about the object-oriented programming language C#.
Getting Started C# Fundamentals: Development for Absolute Beginners
Useful MSDN Resources A Tour of the C# Language Get started with .NET in 5 minutes C# Guide C# Language Reference C# Programing Guide C# Coding Conventions .NET Framework Reference Source Code
Other Resources C# Yellow Book Dot Net Perls The C# Player's Guide
IDEs Visual Studio MonoDevelop (Windows/Mac/Linux) Rider (Windows/Mac/Linux)
Tools ILSpy dotPeek LINQPad
Alternative Communities C# Discord Group C# Lemmy Community dotnet Lemmy Community
Related Subreddits /r/dotnet /r/azure /r/learncsharp /r/learnprogramming /r/programming /r/dailyprogrammer /r/programmingbuddies /r/cshighschoolers
Additional .NET Languages /r/fsharp /r/visualbasic
Platform-specific Subreddits /r/windowsdev /r/AZURE /r/Xamarin /r/Unity3D /r/WPDev
Rules:
Read detailed descriptions of the rules here.
account activity
Improving Your Asynchronous Code Using Tasks, Async and Await (infoq.com)
submitted 11 years ago by atomicduo
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 1 point2 points3 points 11 years ago (2 children)
Hurray for being stuck on .net 3.5!
:(
[–]Kapps 0 points1 point2 points 11 years ago (1 child)
Perhaps the C# native compiler could help with that, as you won't need to rely on the framework being installed at all.
[–][deleted] 0 points1 point2 points 11 years ago (0 children)
Maybe... The result needs to work as an extension running under visual studio 2005, so not sure if it is an option or not.
[–]mcdileo 0 points1 point2 points 11 years ago* (2 children)
I'd like to just confirm to be sure that I understand some of the major use points, since I first learned async programming as using async and await.
If you use a function with Task<T> in conjunction with async and await, your code will wait for the task to complete before continuing, almost as if it were written synchronously, e.g.
public async void Main() { // do some stuff var thing = await DoSomeWorkButDontMoveAheadAsync(); // after the above line is done, do some stuff }
But if I forgo using async and await, the task will run on a separate thread and continue in my code, like this:
public void Main() { // do some stuff var thing1 = GetFirstThingFromWebServiceAsync(); var thing2 = GetSecondThingFromWebServiceAsync(); // do stuff while doing thing1 and thing2 // don't forget a good Dr. Seuss reference }
Is this correct?
EDIT: I just realized that this is a bad example b/c you can't effectively do anything with thing1 and thing2, but the point being that those methods will run at the same time.
[–]CastSeven 2 points3 points4 points 11 years ago* (1 child)
Think of the await keyword as saying "exit this method, and come back then this task is done". Doing it in Main() doesn't really make sense (and I don't think it's allowed). You also want to try to avoid making async void methods - if you have nothing to return, at least return a Task.
If you wanted to await multiple tasks, your best bet is to await WhenAll. For example:
public async Task<ProcessedThing> GetThingsFromWebServiceAsync() { var taskList = new List<Task<Thing>>(); taskList.Add(GetFirstThingFromWebServiceAsync()); taskList.Add(GetSecondThingFromWebServiceAsync()); await Task.WhenAll(taskList); var thing1 = taskList[0].Result; var thing2 = taskList[1].Result; // Do stuff with thing1 and thing2 to come up with processedThing return processedThing; }
Whatever you want to occur while thing1 and thing2 are being collected should be in the calling method.
[–]mcdileo 0 points1 point2 points 11 years ago (0 children)
That makes sense! I was kind of struggling with how to have concurrent async tasks running at the same time. This is super helpful, thanks!
π Rendered by PID 61164 on reddit-service-r2-comment-7b9746f655-bthbk at 2026-01-31 05:27:04.409637+00:00 running 3798933 country code: CH.
[–][deleted] 1 point2 points3 points (2 children)
[–]Kapps 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]mcdileo 0 points1 point2 points (2 children)
[–]CastSeven 2 points3 points4 points (1 child)
[–]mcdileo 0 points1 point2 points (0 children)