String Interpolation and StringBuilder

This post looks into different approaches and their performance characteristics for appendnng interpolated like strings. I use BenchmarkDotNet to benchmark the different solutions. In case of all benchmarks I have 3 string properties A, B and C each holding one of these values:

  • hello

  • world

  • how are you

The values of these variables are set in a Global setup step of BencharmarkDotNet. In all benchmarks the three string are concatenate with some punctuations.

Implementation

Find out more


Introduction to APM 3

In the series of these posts I will look into how we can implement an APM solution for .NET applications. Application Performance Management (APM) helps to monitor and diagnose application performance. There are numerous libraries and tools out there to solve this given problem. In this series of posts I will focus on implementing APM for .NET applications (.NET Framework 461 and above, .NET Core and NET5) with OpenTelemetry.

In the series of these posts I will look into the following topics. The current post looks into creating and recording spans.

  • W3C correlation Id specification

  • Creating and recording spans with ActivitySource

  • Using OpenTelemetry and Jaeger

OpenTelemetry

Find out more


Introduction to APM 2

In the series of these posts I will look into how we can implement an APM solution for .NET applications. Application Performance Management (APM) helps to monitor and diagnose application performance. There are numerous libraries and tools out there to solve this given problem. In this series of posts I will focus on implementing APM for .NET applications (.NET Framework 461 and above, .NET Core and NET5) with OpenTelemetry.

In the series of these posts I will look into the following topics:

  • W3C correlation Id specification

  • Creating and recording spans with ActivitySource

  • Using OpenTelemetry and Jaeger

This post looks into creating and recording spans.

Find out more


Introduction to APM 1

In the series of these posts I will look into how we can implement an APM solution for .NET applications. Application Performance Management (APM) helps to monitor and diagnose application performance. There are numerous libraries and tools out there to solve this given problem. In this series of posts I will focus on implementing APM for .NET applications (.NET Framework 461 and above, .NET Core and NET5) with OpenTelemetry.

In the following posts I will look into the following topics, starting with the first one in this post:

  • W3C correlation Id specification

  • Creating and recording spans with ActivitySource

  • Using OpenTelemetry and Jaeger

W3C correlation Id specification

Find out more


If it is not string

Introduction

In this post I am looking into the internals of the is not pattern, which is introduced in C# 9. This pattern allows the code to be more expressive. Assume to have a method with a type of an object input parameter, which needs validation. The method may only work if the object is a 2 character long string value. For example, we would like to validate that the string is a two letter country code.

C# 9 allows is not patterns. Using this pattern, we can express the above example with the following code:

using System;
object o1 = "UK";
if (o1 is not string countryCode || countryCode.Length != 2)
    Console.WriteLine("Invalid country code");
else
    Console.WriteLine(countryCode);

Find out more