All posts with Tag String

StringBuilders magic for very large strings

The StringBuilder class is used to create mutable sequences of characters. Strings are immutable, so if you need to perform multiple operations on a string, it is better to use a StringBuilder instead of a string. This is especially useful when you need to concatenate a large number of strings. But there is more magic to it, especially when we go BIG!

Read the whole article

Preview image blogpost

"Use always a StringBuilder" - Internet myths

Use always a StringBuilder

That is what you can read from time to time. The basic idea is, that a StringBuilder is "better" to be defined.

Why are people telling that lie? Let's discuss this and see what it isn't true.

Read the whole article

Create a low allocation and faster StringBuilder - Span in Action

.NET ships a nice StringBuilder since the dawn of time or at least since the beginning of the framework itself. The intention is simple: If we need to concatenate a lot of strings we can't rely on the + operator as we introduce a lot of unnecessary allocations plus it is slow! That is where the StringBuilder jumps into the picture.

Why is that? Why is the StringBuilder better? And can we do better? Spoiler: Yes!

Read the whole article

Preview image blogpost

The Trie - A powerful data structure

A Trie is a common data structure used for example for auto completing words. We will discover how to built our own Trie and check how fast he competes against a "normal" Hashset.

Also we will build a TypeAHead input component which automatically offers us some suggestion based on our input. Of course, we will use our newly created Trie.

Read the whole article

Preview image blogpost

A story about boxing / unboxing and string interpolation in C#

A story about boxing / unboxing and string interpolation in C#. What has string interpolation to do with boxing / unboxing and what's the impact?

Read the whole article

An error has occurred. This application may no longer respond until reloaded. Reload x