Skip to content

Instantly share code, notes, and snippets.

@stjeong
stjeong / DefaultInterpolatedStringHandler_sample.cs
Last active July 23, 2023 23:18
C# 10 - string interpolation
// Refer to tweet - https://twitter.com/Dave_DotNet/status/1682699744747958274
// This code allocates same 72 bytes in GC Heap.
// However this may be slower than string.Create, because DefaultInterpolatedStringHandler is made for more general purpose.
// C# 10+ and .NET 6+
string title = "Mr.";
string first = "David";
string middle = "Patrick";
string last = "Callan";