Davide Bellone

Davide Bellone @bellonedavide

About: Fullstack in my past, backend in my future. C# and .NET in my 💘 Content creator, Microsoft MVP, public speaker.

Location:
Turin, Italy
Joined:
Mar 21, 2019

Davide Bellone
articles - 109 total

C# Tip: ObservableCollection - a data type to intercept changes to the collection

ObservableCollection is a data type that allows you to react when an item is added or removed from the collection. Let’s learn more!

Learn More 1 0Aug 27 '24

C# Tip: IFormattable interface, to define different string formats for the same object

Same object, different string representations. How do we achieve it in a standardised way?

Learn More 0 0Aug 29 '24

How to create custom snippets in Visual Studio 2022

A simple way to improve efficiency is knowing your IDE shortcuts. Let’s learn how to create custom ones to generate code automatically.

Learn More 0 0Aug 27 '24

Is Random.GetItems the best way to get random items in C# 12?

You have a collection of items. You want to retrieve N elements randomly. Which alternatives do we have?

Learn More 0 0Aug 28 '24

Davide's Code and Architecture Notes - Cache Expiration vs Cache Eviction (and Eviction Policies)

Caching helps your applications be more performant. However, depending on the cache size, you’ll need to sacrifice some items to make space for others. Let’s see some strategies.

Learn More 0 0Aug 28 '24

Davide's Code and Architecture Notes - Tracking decision with Architecture Decision Records (ADRs)

When designing a system’s architecture, you have many choices to make. How can you track them? ADRs are formal documents to track the reasons behind your decisions, giving context and info about the consequences of each choice.

Learn More 0 0Aug 20 '24

Davide's Code and Architecture Notes - Introducing SLI, SLO, and SLA

Non-functional requirements. How can you ensure you meet them? Let’s understand SLO, SLA, and SLI, and how they affect your SDLC.

Learn More 0 0Oct 1 '24

Why reaching 100% Code Coverage must NOT be your testing goal (with examples in C#)

Average teams aim at 100% Code Coverage just to reach the number. Great teams don’t. Why?

Learn More 1 0Sep 26 '24

4 ways to create Unit Tests without Interfaces in C#

C# devs have the bad habit of creating interfaces for every non-DTO class because «we need them for mocking!». Are you sure it’s the only way?

Learn More 3 1Feb 5 '24

C# Tip: Use TestCase to run similar unit tests with NUnit

In my opinion, Unit tests should be well structured and written even better than production code. In...

Learn More 0 0Jan 17 '24

How to kill a process running on a local port in Windows

Now you can't run your application because another process already uses the port. How can you find that process? How to kill it?

Learn More 0 0Aug 20 '24

How to extract, create, and navigate Zip Files in C#

When working with local files, you might need to open, create, or update Zip files. In this article,...

Learn More 0 0Jan 3 '24

Davide's Code and Architecture Notes - 4 algorithms to implement Rate Limiting, with comparison

When developing any API application, whether it is a monolith, a microservice, a distributed system,...

Learn More 0 0Jan 2 '24

C# Tip: How to create Unit Tests for Model Validation

Model validation is fundamental to any project: it brings security and robustness acting as a first...

Learn More 0 0Dec 18 '23

Pre-commit hooks with Husky.NET - build, format, and test your .NET application before a Git commit

If you need to run operations before completing a Git commit, you can rely on Git Hooks. Git hooks...

Learn More 0 0Dec 12 '23

Davide's Code and Architecture Notes - Pros and Cons of API Gateways (plus vendors comparison)

Especially when talking about microservices, many articles and videos focus on an architectural...

Learn More 0 0Dec 11 '23

Davide's Code and Architecture Notes - L4 vs L7 Load Balancer

When handling a massive amount of requests, a system generally needs to balance the incoming load to...

Learn More 0 0Nov 17 '23

OhMyPosh and CascadiaCode not working on PowerShell? How to fix it in Windows 10 and Windows 11 Integrated Terminal

The content of the blog you are reading right now is stored in a Git repository. Every time I create...

Learn More 0 0Dec 18 '23

How to integrate Feature Flags stored on Azure App Configuration in an ASP.NET Core Application

Feature Flags let you remotely control the activation of features without code changes. They help you...

Learn More 1 0Nov 17 '23

Davide's Code and Architecture Notes - Postel's law for API Robustness

When designing and building Web APIs, we should follow Postel's law to make our API more...

Learn More 0 0Oct 3 '23

C# Tip: Access items from the end of the array using the ^ operator

Say that you have an array of N items and you need to access an element counting from the end of the...

Learn More 0 0Jul 4 '23

Top 6 Performance Tips when dealing with strings in C# 12 and .NET 8

Sometimes, just a minor change makes a huge difference. Maybe you won't notice it when performing the...

Learn More 0 0Feb 27 '24

PriorityQueues on .NET 7 and C# 11

Starting from .NET 6 and C# 10, we finally have built-in support for PriorityQueues 🥳 A...

Learn More 2 0Jan 27 '23

How to solve InvalidOperationException for constructors using HttpClientFactory in C#

A few days ago I was preparing the demo for a new article. The demo included a class with an...

Learn More 9 0Nov 10 '22

How to log Correlation IDs in .NET APIs with Serilog

Correlation IDs are values that are passed across different systems to correlate the operations...

Learn More 10 0Nov 10 '22

Clean Code Tip: Avoid subtle duplication of code and logic

Duplication is not only about lines of code, but also about data usage and meaning. Reducing it will...

Learn More 1 0Oct 21 '22

C# Tip: Use Debug-Assert to break the debugging flow if a condition fails

Sometimes, while debugging, you want to check if the state of your code is still valid, or, at least,...

Learn More 6 0Oct 21 '22

PostgreSQL CRUD operations with C# and Dapper

In a previous article, we've seen how to perform simple CRUD operations on a Postgres database by...

Learn More 5 0Oct 21 '22

3 (and more) ways to set configuration values in .NET

Needless to say, almost every application needs to deal with some configurations. There are tons of...

Learn More 1 0Jul 4 '23

Clean Code Tip: Keep the parameters in a consistent order

If you have a set of related functions, use always a coherent order of parameters. Take this bad...

Learn More 1 0Oct 14 '22