Hot answers tagged

2 votes

Truncating/abbreviating strings in the middle with an ellipsis (…) (or other) separators with a fixed character limit

Thanks to Peter Csala for providing you an example on how to convert your code into using Span<T>, and I think his answer covered that. I just want to add ...
iSR5's user avatar
  • 5,208
2 votes
Accepted

Truncating/abbreviating strings in the middle with an ellipsis (…) (or other) separators with a fixed character limit

Let me present you an alternative version of your TruncateInMiddle which utilizes ReadOnlySpans. The core logic can be rewritten ...
Peter Csala's user avatar
  • 8,820
2 votes

Implementation of Concurrent List in .NET

There appear to be several threading bugs in this implementation. Just the first line with any logic in it, what if two threads call Insert with ...
Pierre Menard's user avatar
1 vote

Should the SqlConnection Be a Class Field or Should I Pass It In and Out Of Functions As Needed?

Should the SqlConnection and the SqlCommand be class fields instead of being passed around? None of the above. Have a SqlAdapter object and compose it with the connection, command, et.al. Then your ...
radarbob's user avatar
  • 7,494
1 vote

How can I design the configuration of the library with Typed HttpClients in DI better?

Which C# version are you using? It seems like a lot of things could be simplified / make it more concise by utilizing newer C# features. – Peter Csala I am using C# 10. – Junaid @PeterCsala can you ...
Peter Csala's user avatar
  • 8,820

Only top scored, non community-wiki answers of a minimum length are eligible