For my work moving Spargine to .NET 6, I have completely rewritten the Spargine methods to validate method parameters. In this release, these methods have been changed to allow fluent validation.
The dotNetDave For Those About to Code: Worldwide Tour will be at the Philly Code Camp in Philadelphia, PA on March 4th. I hope you will join me at this meeting.
Let’s face it, no software engineers like fixing bugs in code. Since no software is perfect, they are going to happen. They are a fact of life for software engineers. Sometimes, it feels like we are playing the game Whack-A-Mole where no matter how many we fix, more will pop up.
Lets face it, none of us write perfect code all the time! Especially since there are many ways to write the code to achieve its purpose. The best way to make sure the code is the best it can be is by asking someone to review it!
Do you use object-oriented programming? If so, do you validate data coming into your types? If not, then you have broken the first pillar of OOP which is encapsulation.
XML serialization has been around ever since .NET was released since it was so widely used back then. It’s still widely used, especially for legacy applications and services, even iTunes still uses XML to store library information. Benchmark results are for .NET 5 & 6.
A newer way of creating simple methods in .NET is by using expression-bodied methods. This article shows which method is more performant.
Most of the code analysis tools, including tools from Microsoft, recommends creating static methods if possible, stating performance as one of the reasons. But are static methods more performant than normal non-static methods? This articles shows your which is more performant!
Encoding and decoding strings to and from a byte is used a lot in programming. Performance results are for using The formatting options are ASCII, Unicode, UTF8, and UTF32.
When concatenating many strings, especially in a loop, using the StringBuilder class is usually more performant and uses less memory.