SleepWellPupper
SleepWellPupper
CC#
Created by Emirka on 1/15/2025 in #help
Learn help
I see. Yeah, learning buddies are fine.
7 replies
CC#
Created by Emirka on 1/15/2025 in #help
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
CC#
Created by Mormon Son on 12/27/2024 in #help
Source Generator IDE interaction
Could you share the SG repo?
19 replies
CC#
Created by Auxl on 12/30/2024 in #help
Uri.TryCreate failing when input is from Chinese localized text
Could you provide some code and possibly a minimum viable example so that we may reproduce the issue?
16 replies
CC#
Created by Carsillas on 12/25/2024 in #help
Record equality override only for base members
Remember to also implement int GetHashCode() => 0 so it's disregarded foor hashsets.
3 replies
CC#
Created by Red Legion on 12/22/2024 in #help
I cant figure out how to add a subprocess to my app
You might have had some help provided, had you provided more $details
9 replies
CC#
Created by stigzler on 12/2/2024 in #help
Sloppy Constructors
Sorry about the reaction image, I assumed that tag produced the rules list.
8 replies
CC#
Created by stigzler on 12/2/2024 in #help
Sloppy Constructors
Please refer to the $rules Specifically:
Relaying ChatGPT/AI generated answers or sending Let Me Google That For You links is heavily discouraged, use of either may not be tolerated.
8 replies
CC#
Created by PerfidiousLeaf on 12/4/2024 in #help
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
CC#
Created by MaggyD on 12/4/2024 in #help
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
CC#
Created by Nywon on 12/10/2024 in #help
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
CC#
Created by Sayoregg on 12/11/2024 in #help
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
CC#
Created by SWEETPONY on 12/5/2024 in #help
Is it possible to use pattern matching here?
Note that for this one to work, the "SVO" string needs to be a constant.
10 replies
CC#
Created by SWEETPONY on 12/5/2024 in #help
Is it possible to use pattern matching here?
Could use some terseness with the variable names I suppose.
10 replies
CC#
Created by SWEETPONY on 12/5/2024 in #help
Is it possible to use pattern matching here?
Here's another pattern:
return new PresentationModel
{
Terminal = entity.LegData?.Location switch
{
{ LatestArrivalStationIataCode: "SVO", LatestDepartureStationIataCode: not "SVO" } arrivalLocation => arrivalLocation.ArrivalTerminal,
{ LatestArrivalStationIataCode: not "SVO", LatestDepartureStationIataCode: "SVO" } departureLocation => departureLocation.DepartureTerminal,
_ => throw new InvalidOperationException("no location provided or invalid station codes set")
}
};
return new PresentationModel
{
Terminal = entity.LegData?.Location switch
{
{ LatestArrivalStationIataCode: "SVO", LatestDepartureStationIataCode: not "SVO" } arrivalLocation => arrivalLocation.ArrivalTerminal,
{ LatestArrivalStationIataCode: not "SVO", LatestDepartureStationIataCode: "SVO" } departureLocation => departureLocation.DepartureTerminal,
_ => throw new InvalidOperationException("no location provided or invalid station codes set")
}
};
10 replies
CC#
Created by VoidPointer on 11/8/2024 in #help
✅ How to specify camel case for all response properties with Newtonsoft
Seconding the viability voncerns about converters: Notice that camelCase AND snake_case are being used.
11 replies
CC#
Created by Wrenpo on 11/5/2024 in #help
Safely getting a result from a async method within a sync method
I'd like to know why the method needs to be synchronous @Wrenpo
37 replies
CC#
Created by Wrenpo on 11/5/2024 in #help
Safely getting a result from a async method within a sync method
This I agree with.
37 replies
CC#
Created by Wrenpo on 11/5/2024 in #help
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/await
37 replies
CC#
Created by Wrenpo on 11/5/2024 in #help
Safely getting a result from a async method within a sync method
37 replies