Skip to main content
Share Your Experience: Take the 2024 Developer Survey

New answers tagged

1 vote
Accepted

JSON data converting to Excel File

My first thought was why don't you use DataTable? Json.Net supports (de)ser from/to DataTable EPPlus supports loading from <...
Peter Csala's user avatar
  • 9,159
2 votes

The Never-Ending IFs

You have two issues here, the first one is that you should invert the condition for early return, which would decrease the nesting levels. The second issue is understanding the related executions and ...
iSR5's user avatar
  • 5,278
2 votes
Accepted

Passing in method as func and using dynamic to circumvent type checking

Needing to access a distant RDBMS across the WAN can induce noticeable latencies. Fast unit tests may need a high fidelity mock of a database. Let's leave aside the matter of whether "no DB ...
J_H's user avatar
  • 27.6k
1 vote

Concatenating two possibly null strings with a separator

The following avoids temporary variables and unnecessary concatenation. ...
Jean-Bernard Pellerin's user avatar
2 votes

Convention based OpenApi schema generation for dotnet and NSwag

Overall very nice. Concise, easy to follow, quite clear when the description is available. A few suggestions anyways: Documentation I hope you have at least a bit of documentation on that code in the ...
Vogel612's user avatar
  • 25.2k
2 votes
Accepted

Recursively iterate over every object in an object graph looking for specific types

I think the answer here is to just not use a yielding iterator because I don't really need to: ...
ScottishTapWater's user avatar
8 votes
Accepted

The Never-Ending IFs

Your ConfigureApplicationAsync method calls 9 async methods in a predefined sequence (which might be too much responsibilities for a single method btw). Each of the ...
Peter Csala's user avatar
  • 9,159
2 votes

Coding puzzle - Passing year books

Question: I would suggest to ignore the "fluff" of the pretend real-world example and try to translate the problem into its general terms. I believe, with a small twist, that this question ...
Alex's user avatar
  • 41
3 votes

Display summary statistics about Discord messages

Yes, as you have indicated, the very first step should be to split your code into dedicated modules. Almost all of your methods are used only once. A very natural split could be to encapsulate those ...
Peter Csala's user avatar
  • 9,159

Top 50 recent answers are included