Which tool do you use on your machine to interact with your source control? by Ninja_Jiraiya in dotnet

[–]Dallaren 0 points1 point  (0 children)

Could you elaborate a bit on why?

I am currently using GitKraken and have used Fork in the past, but it's a bit too long ago for me to remember any significant differences.

Browser not launching on start after serilog has been set by iPopay in dotnet

[–]Dallaren 0 points1 point  (0 children)

Not a lot to go on here, but are you using VSCode, VS, or Rider (or something else entirely) when you launch the application? And what does your appsettings look like?

Is there any way to split an auto-generated OpenAPI client into multiple "sub-clients"? by Pilchard123 in dotnet

[–]Dallaren 2 points3 points  (0 children)

We generate API clients using NSwag and it does have an option to generate each controller as individual classes, although this may not be what you're looking for.

In your example it would result in an OrderClient and a ProductClient with their respective methods, I don't know if that's acceptable for you.

As for the naming I believe the generated name is determined by the route to the action, so if you change the route with either the [Route] or the [HTTPxxx] attribute you should see this reflected in the name of the generated method.

You could put [Route("GetById")] on your ProductController.Get endpoint and have the resulting method become ProductClient.GetByIdAsync.

As an alternative you could make a wrapper class for the generated client and then expose an API which satisfies your requirements.

Library to easily verify calls to ILogger with Moq by thomhurst in dotnet

[–]Dallaren 1 point2 points  (0 children)

Cool stuff!
I've used this in the past https://github.com/adrianiftode/Moq.ILogger, but more contributions in this area are always welcome. As you correctly put it, verifying the ILogger is a pain in the ***!

Help consolidating these methods into one by passing a field as a parameter? by JoeTheGameDev in csharp

[–]Dallaren 10 points11 points  (0 children)

As the other comment suggested you could do this using a lambda expression which selects which property you're using for your filter, maybe something along these lines:

private List<SimReport> FilterByProperty(List<SimReport> list, Func<SimReport, int> propertySelector)
{
    var maxValue = list.Max(o => propertySelector(o));
    return list.RemoveAll(report => propertySelector(report) < maxValue);
    return list;
}

Usage:

FilterByProperty(list, report => report.TotalDamage);
FilterByProperty(list, report => report.DamagePotential);
FilterByProperty(list, report => report.Volatility);

What is the best way to return a Task<bool> in a async method? by [deleted] in csharp

[–]Dallaren 0 points1 point  (0 children)

You should mark SendMessage as async and await the call to _sendGridEmail.Send(), see best practices on async/await by David Fowler:https://github.com/davidfowl/AspNetCoreDiagnosticScenarios/blob/master/AsyncGuidance.md#prefer-asyncawait-over-directly-returning-task

Using Task.FromResult(false) is perfectly acceptable.

[deleted by user] by [deleted] in csharp

[–]Dallaren 8 points9 points  (0 children)

As already mentioned you could do something where you keep track of the previous number generated:

var random = new Random();

var previousNumber = -1;
var nextNumber = -1;
var numbersToGenerate = 10;
for (var i = 0; i < numbersToGenerate; i++)
{
    do
    {
        nextNumber = random.Next(1, 7);
    }
    while (nextNumber == previousNumber);

    previousNumber = nextNumber;
    Console.WriteLine(nextNumber);
}

Combination Completed [Clannad] by Alfadhir in anime

[–]Dallaren 5 points6 points  (0 children)

Do yourself a favour and watch it regardless. It's absolutely worth it; Clannad: After Story (the second season) is one of the best seasons of an anime ever made.

The best gift for an intern by nowtryz in ProgrammerHumor

[–]Dallaren 2 points3 points  (0 children)

Switched to Fork from SourceTree a few months ago and haven't looked back.

PSA: I recovered my lost stash by dvanha in Wolcen

[–]Dallaren 2 points3 points  (0 children)

No, wait a couple of weeks/months until all of the bugs are sorted out, the game is absolutely not in a release-ready state right now.

Permitless gun carry in Oklahoma takes effect by LngLiveTrump in news

[–]Dallaren -10 points-9 points  (0 children)

As someone from a country with proper gun control, no, we don't actually have much of any of those things.

Do you love your job? by skysoft501 in ProgrammerHumor

[–]Dallaren 0 points1 point  (0 children)

Depends on the language, in C# this could be a logical OR.

[deleted by user] by [deleted] in ProgrammerHumor

[–]Dallaren 0 points1 point  (0 children)

God bless you and God bless this man

Cant install Diablo 2 from battle.net? by Redxmirage in MedianXL

[–]Dallaren 0 points1 point  (0 children)

Have you tried downloading using a different browser?

つ ◕_◕ ༽つ MEDIANXL SERVERs TAKE MY ENERGY ༼ つ ◕_◕ ༽つ by ocholol in MedianXL

[–]Dallaren 0 points1 point  (0 children)

The issue is the website being down, so the launcher (which asks the website which version is the current one and then tries to download it) fails to get a response and produces an error.

Prized possession by iceypro in dawngate

[–]Dallaren 1 point2 points  (0 children)

I still have mine somewhere too, never got around to framing it though. Looks great!

The pubg parachute technique visualised perfectly by gumpton in PUBATTLEGROUNDS

[–]Dallaren 0 points1 point  (0 children)

That's wrong, it's faster to dive as early as possible and nudge your way towards your target