Expression-bodied members in properties
Are these two expressions the same?
public class MyClass
{
public int A { get; } = Random.Shared.Next(1000);
public int B => Random.Shared.Next(1000);
}
Hey, I'm Steven a .NET Developer in Switzerland. I am a Microsoft MVP. Also, this blog is open source on GitHub.
Are these two expressions the same?
public class MyClass
{
public int A { get; } = Random.Shared.Next(1000);
public int B => Random.Shared.Next(1000);
}
Enum
s are very simple structures, but some functions like Enum.TryParse
can have unexpected behavior. In this short blog post, we discover why and what are the alternatives.
With respect to the current topic around Moq
, I want to showcase how you can easily roll out your own fakes so that you are not depending on a third party library.¨
The famous Moq
library faced some criticism due to the usage of SponsorLink
. What is the problem, and what is going on here? And obviously, I will add all the sources to the articles.
The .NET 8 preview 7 will bring another exciting feature some of you probably awaiting for a long time: Keyed services.
Where C# is the most dominant language in the .NET world, other languages are built on top of the Framework that deserves their respective place. F# is strong when it comes down to functional programming! In this blog post, we will leverage the power of F# and C# to showcase where both excel!
With the famous BenchmarkDotNet library you can benchmark a lot - but it doesn't stop with a single .NET version. You can benchmark multiple versions of the same code that targets different runtimes!
Working with databases can sometimes be daunting, mainly when errors occur. These errors or exceptions can be due to many reasons, such as constraint violations, connection issues, or syntax errors. Entity Framework throws a generic DbException
or DbUpdateException
for most of these database issues. But we cand get more specific exceptions based on the concrete "problem"! That's where EntityFramework.Exceptions comes in.
I was recently tasked to migrate an application with around 150 projects from the "old"It is still supported .NET Framework 4.8 to a recent .NET 6. As the application is still under development and used, the migration should be done step by step over time in iterative steps rather than a big bang refactoring. This blog post will go a bit into more detail about how I approached the situation and what I learned.
This is a highly subjective post, and there are plenty of ways of approaching it - so take it with a grain of salt and mileage may vary.
In this short blog post, I want to showcase three nice tricks you can do with everybody's favorite data type: the dictionary.
It is a versatile data structure, and we can make it even more versatile!