The FromSqlInterpolated method in Entity Framework Core is used to execute a raw SQL query that contains interpolated parameters. Interpolated … Continue reading Entity Framework FromSqlInterpolated examples
GitHub examples of .NET method usages visible in Visual Studio from 17.6+
From Visual Studio 2022 17.6 we’ll be able to see real world examples of common .NET APIs on GitHub direct … Continue reading GitHub examples of .NET method usages visible in Visual Studio from 17.6+
Simple string concatenation using String.Create and other performance sensitive approaches in .NET 8
I posted my previous simple string concatenation benchmark results where I was concatenating my name with spacer on Reddit recently. … Continue reading Simple string concatenation using String.Create and other performance sensitive approaches in .NET 8
NuGet 6.7 shows which packages are vulnerable in Visual Studio
With NuGet 6.7 which is available in Visual Studio 2022 17.8 Preview 1 (August 8th 2023) we can now see … Continue reading NuGet 6.7 shows which packages are vulnerable in Visual Studio
New summary diff view to only see changes now available in Visual Studio
Visual Studio 2022 17.8 Preview 1 was released last week (8th August 2023) and a really cool new feature it … Continue reading New summary diff view to only see changes now available in Visual Studio
Please follow me on X/Twitter and LinkedIn for more .NET content
I post .NET / C# and Visual Studio content on LinkedIn and X/Twitter almost daily. Please consider following me. LinkedIn … Continue reading Please follow me on X/Twitter and LinkedIn for more .NET content
Do .NET developers rely too much on third party libraries from NuGet?
Do we rely too much on third party libraries from NuGet? Are we exposing our clients to risks here by … Continue reading Do .NET developers rely too much on third party libraries from NuGet?
Poll Results : Are many .NET devs moving away from Moq after #moqgate?
I took this Twitter poll recently to gauge how many devs were thinking of moving away from Moq after the … Continue reading Poll Results : Are many .NET devs moving away from Moq after #moqgate?
7 Cognitive biases influencing our software development decisions
What are Cognitive Biases? A cognitive bias is a systematic thinking error that affects our decisions and judgments. They’re our … Continue reading 7 Cognitive biases influencing our software development decisions
Do you use a mocking framework or manually create your mocks?
Dear .NET friends, how do you like to create your mocks? 🤔 …With a framework like Moq or manually? I … Continue reading Do you use a mocking framework or manually create your mocks?
How to treat all warnings as compile errors in .NET
Warnings are too easy to ignore. Consider treating all warnings as errors by setting the TreatWarningsAsErrors property to true in … Continue reading How to treat all warnings as compile errors in .NET
Share settings across multiple projects using a Directory.Build.props file
To set properties for every project in a directory in a centralized location create a Directory.Build.props file in your solution … Continue reading Share settings across multiple projects using a Directory.Build.props file
Use Target Typed New Expressions to infer type on the right in C# 9 +
In C# 9 Target Typed New Expressions were introduced. They allow us to infer type on the right, whereas var … Continue reading Use Target Typed New Expressions to infer type on the right in C# 9 +
Poll Results : What .NET mocking library do you use?
I was wondering recently which .NET mocking library is most popular. I suspected Moq but ran a poll to find … Continue reading Poll Results : What .NET mocking library do you use?
Use params keyword in C# to accept a variable number of arguments of the same type
Do you know about the PARAMS keyword in C# ? The params keyword allows us to create methods that accept … Continue reading Use params keyword in C# to accept a variable number of arguments of the same type
How to create Parameterized Tests with xUnit
I love parameterized tests. Instead of many different test methods with different inputs set in the method body we have … Continue reading How to create Parameterized Tests with xUnit
Moq, NSubstitute and FakeItEasy mocking library syntax comparison
Which .NET mocking library syntax do you prefer from the below test examples? Moq?NSubstitute?FakeItEasy? … and which library do you … Continue reading Moq, NSubstitute and FakeItEasy mocking library syntax comparison
Poll Results : Does TDD improve code quality over writing tests after code?
It’s always a divisive topic but in your experience, does Test-Driven Development (TDD) improve code quality more than writing tests … Continue reading Poll Results : Does TDD improve code quality over writing tests after code?
Using IEntityTypeConfiguration config classes to configure Entity Framework entity mappings
When using Entity Framework, storing mapping configurations inline directly in OnModelCreating can make our DbContext class cumbersome and less readable … Continue reading Using IEntityTypeConfiguration config classes to configure Entity Framework entity mappings
.NET 8 simple string concatenation benchmarks
Just for fun, I took benchmarks using BenchmarkDotNet to see what’s the fastest out of common ways used to concatenate … Continue reading .NET 8 simple string concatenation benchmarks
C# 11 list pattern examples
Beginning with C# 11, we can use list patterns to match elements of a list or array. Some examples of different types … Continue reading C# 11 list pattern examples
String.Equals with OrdinalIgnoreCase compared to ToLower / ToUpper for string insensitive comparisons in C#
In C#, when checking if strings are equal in a case insensitive way prefer string.Equals with OrdinalIgnoreCase over using ToLower() … Continue reading String.Equals with OrdinalIgnoreCase compared to ToLower / ToUpper for string insensitive comparisons in C#
String.Equals with OrdinalIgnoreCase faster in .NET 8 compared with .NET 7
There’s some awesome string comparison OrdinalIgnoreCase improvements coming in .NET 8, although I did see one regression too. Click on … Continue reading String.Equals with OrdinalIgnoreCase faster in .NET 8 compared with .NET 7
How to validate all benchmarked methods return the same value with BenchmarkDotNet
Instead of calling your benchmark methods outside the context of BenchmarkDotNet to validate they all return the same value, let … Continue reading How to validate all benchmarked methods return the same value with BenchmarkDotNet
How to order BenchmarkDotNet results from fastest to slowest
By default BenchmarkDotNet outputs the results of benchmarks as they are coded in the benchmark class file. If you wish … Continue reading How to order BenchmarkDotNet results from fastest to slowest