.NET Tips and Tricks & ValueStringBuilder
I want to showcase two of my many side projects. My .NET Tips and Tricks website, where I collect and categorize, well, tips and tricks around .NET-related topics as well as my ValueStringBuilder
.
Hey, I'm Steven a .NET Developer and Freelancer in Zurich, Switzerland. I am a Microsoft MVP. Also, this blog is open source on GitHub.
I want to showcase two of my many side projects. My .NET Tips and Tricks website, where I collect and categorize, well, tips and tricks around .NET-related topics as well as my ValueStringBuilder
.
Strings are one of the most universal data types. We use them for URLs or regular expressions or even to define some date. With .NET 7 we have a new way of giving those strings a bit of meaning. Meet StringSyntaxAttribute
.
I also show you a way how to use them in .NET 6 and earlier.
There is still a long road ahead of us until the release of .NET 8, but the first new language constructs are getting public. The first one I want to present is: Default Parameters in Lambdas.
Many know that you can take ReadOnlySpan<char>
objects when dealing with string
s. They give you a direct way of operating on the underlying memory. Often times you can use them interchangeably, but there are scenarios where you really have to watch out what is going on.
This blog post will have a look at a major problem with ReadOnlySpan
when used like a "regular" string
.
Does your Dependency Injection container is one big pile of method calls one after the other?
Are there 50 lines of just AddScoped
, AddTransient
, and so on? Well, let's fix this.
We can utilize extension methods to make an order to that mess!
.NET knows a big list of collection-like types like: IEnumerable
, IQueryable
, IList
, ICollection
, Array
, ISet
, ImmutableArray
, ReadOnlyCollection
, ReadOnlyList
, and many more.
This blog post will give you an exhaustive list of types in .NET and when to use what.
This blog post will show you a very simple Dependency Injection container.
This will give a better understanding of what Dependency Injection is and how it is done. And sure we will see how this is related to IoC - Inversion of Control.
Sometimes you have an Id
of an object and want to delete the underlying thing from the database. But it doesn't make sense to load the whole object from the database to memory first. So how can we achieve this quickly?
ChatGPT is going viral right now. Besides funny conversations, you can use that tool to generate also code for you. But does it really hold up to its reputation and it is a serious pairing partner? Let's see.
In the past, it was tricky to get if the current process runs under elevated rights. In the sense of it is run under the sudo group in *nix (Unix, Linux, macOS, you name it) or administrative rights in Windows.
But that changes with .NET 8 as we now have a unified API for that.