wasabi
Help on how async/await works
When you call Foo the first line runs. The second line runs, calling OtherThing, which returns a Task. Because you are awaiting that Task, a new Task is created that is linked to the Task that returns from OtherThing. That new task is set up to, upon completion, jump back into line 3. Whenever that happens, the new task has it's result set to i, and is marked completed, so the caller of Foo then has a Task that will eventually return 1, but only after it's bneen resumed by the first task returned by OtherThing.
12 replies
Help on how async/await works
So, 'async' turns a method into something magical. A state machine. That is organized so that different parts of the method can be invoked independently. What actually happens when await happens is 'control is returned', which literally means the method returns to it's caller. But it returns a Task. That Task can later be used to resume execution of the rest of the method.
12 replies
I am having trouble with some quirks in Visual Studios SSDT (SQL Server Data Tool)
SSDT works fine. And is better in some situations than other tools. Problem is MS refuses to make the project type buildable on the .NET distrbution of MSBuild, so you need to use the VS distributed version and can't build cross platform.
8 replies
Abstract events implemented, but compiler warns they aren't used
https://learn.microsoft.com/en-us/dotnet/standard/events/
Typically, to raise an event, you add a method that is marked as protected and virtual (in C#) or Protected and Overridable (in Visual Basic). Name this method OnEventName; for example, OnDataReceived. The method should take one parameter that specifies an event data object, which is an object of type EventArgs or a derived type. You provide this method to enable derived classes to override the logic for raising the event. A derived class should always call the OnEventName method of the base class to ensure that registered delegates receive the event.
11 replies