JochCool
JochCool
CC#
Created by i like chatgpt on 2/5/2024 in #help
✅ Why is an explicit cast needed even though the implicit cast operator is available?
This works:
C#
(float, float) variable = new Complex(1, 0);
C#
(float, float) variable = new Complex(1, 0);
7 replies
CC#
Created by i like chatgpt on 2/5/2024 in #help
✅ Why is an explicit cast needed even though the implicit cast operator is available?
I think it's because the syntax var (x, y) is deconstruction syntax, so it will try to call a destructor
7 replies
CC#
Created by Blank on 2/2/2024 in #help
✅ Confused about Asynchronous Programming
Oh, yeah I may have messed up the terminology
54 replies
CC#
Created by Blank on 2/2/2024 in #help
✅ Confused about Asynchronous Programming
I haven't worked much with WinForms, but if I recall correctly, it never awaits your event handlers. So the UI can be processed asynchronously while the task is busy.
54 replies
CC#
Created by Blank on 2/2/2024 in #help
✅ Confused about Asynchronous Programming
You're right, using await immediately after getting a task object does not make that code asynchronous. That code at the end is almost correct, but I think it should be like this:
C#
static async Task Main()
{
Task task = someTask();
Console.WriteLine(1);
await task;
}

static async Task someTask()
{
// Do something
await someOtherTask();
// Do something else
Console.WriteLine(2);
}
C#
static async Task Main()
{
Task task = someTask();
Console.WriteLine(1);
await task;
}

static async Task someTask()
{
// Do something
await someOtherTask();
// Do something else
Console.WriteLine(2);
}
This way, the 1 will be printed before awaiting, so it happens at the same time as the other task, making it asynchronous.
54 replies
CC#
Created by YouWouldnt on 1/31/2024 in #help
✅ Help with Simplifying Method further
If you are using Visual Studio, it should already be giving you suggestions for simplifying the code that creates the list
12 replies
CC#
Created by Dultus on 1/24/2023 in #help
❔ Is there a way to remove brackets from empty methods?
As far as I know, no
25 replies
CC#
Created by wcasa on 1/22/2023 in #help
❔ how is c# project compiled??
What do you mean with several c# projects connected
23 replies
CC#
Created by wcasa on 1/22/2023 in #help
❔ how is c# project compiled??
In the screenshot you show only one c# project?
23 replies
CC#
Created by wcasa on 1/22/2023 in #help
❔ how is c# project compiled??
All classes in your project will be compiled; public is only about where in the code you can use the class
23 replies
CC#
Created by wcasa on 1/22/2023 in #help
❔ how is c# project compiled??
Yes, that's correct
23 replies