SleepWellPupper
Learn help
If you want to learn C#, you could checkout the following:
https://learn.microsoft.com/en-us/dotnet/csharp/
Asking for people to add you for helping you is not good etiquette. In addition, this channel is for asking specific questions about a programming problem you're encountering.
7 replies
Dynamically Implementing Interfaces at Runtime
You mentioned wanting to avoid emitting due to maintainability concerns. Also SGs would require recompilation, which you say some users won't be able/willing to do.
You could emit class implementations dynamically not using
Emit
but roslyn, i.e. dynamically compiling source code that you can stitch together at runtime, then loading that new assembly to get the type.
This way, no "wizardry" concerning emitting would be needed, think string manipulation and some roslyn api calls.
Maybe this is useful.40 replies
Idiomatic C# Data Objects with Immutable Collections?
If you're on net9 and using STJ, you could utilize nullable annotations (that is, the absence of) to instruct the serializer:
https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/nullable-annotations
24 replies
Displaying multiple consoles - .NET
This is not specifically what you're asking for but Spectre.Console is a cli app library using which you could have a split output in your terminal, i.e. emulating multiple consoles. Maybe that would be a little simpler than creating two terminals. Afaik that would require multiple processes.
https://spectreconsole.net/
6 replies
Can't access method from one class in another even though it's set to public
Your method is an instance method, so, as you concluded correctly, you can only call it on instances of your class. If you need more info, here are the docs:
https://learn.microsoft.com/en-us/dotnet/csharp/methods#method-invocation
7 replies
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