Post

24 December 2024

24 December 2024

C# 12.0: inline arrays

In C# 12 and .Net 8, you can define a fixed-sized array, which is much more efficient for the memory and the garbage collector.

1
2
3
4
5
[InlineArray(3)]
public struct ThreeFloats
{
    private float element;
}

What’s new in C# 13

A full list of what’s new in C# 13.

Performance Improvements in .NET 9

For those who prefer visual learning, here’s a video about performance improvements in .Net 9. This is a summary of the official blog post. It’s a bit deep, but here are a few takeaways:

  • not actually new, but I should remember to use Span<T> more often, to avoid allocations, eg Span<char> instead of using string and Substring.
  • Use GetAlternateLookup to make lookups in dictionaries, sets, etc more efficient.
  • Use Regex.EnumerateMatches to parse a regex without allocating memory for captures etc.
  • Use EnumerateSplits instead of string.Split for allocation-free splitting - works with Span and regexes.
  • Use SearchValues<string> for super-efficient searching - it’s also used implicitly by regexes.

Microsoft Ignite 2024: all the news from Microsoft’s IT pro event

And a summary of all the announcements from Microsoft Ignite 2024, not just C# and .Net.

Calling methods is easier and faster with C# 13 params collections

allowing params to be any of the collections supported by collection expressions, rather than just arrays

Building on the C# 12 feature of simplified collections: [1, 2, 3],
you can noww define params arguments with any collection type, not just arrays,
so instead of (params byte[] bytes), you can define an argument as (params List<byte> bytes).

LINQ Updates .NET 9

New methods CountBy, AggregateBy, and Index.

Using Testing.Platform with NET 9

There’s a new testing platform in .Net 9, with the imaginative name of Testing.Platform!

MSTest was migrated to .Net Core, but didn’t get much love. This is the new platform. Migrating from XUnit is just a case of changing the project references - the code stays the same. Maybe also to migrate from NUnit and MSTest.

Convincing a billion users to love passkeys

We all know passkeys are the answer to preventing password-related attacks, but it’s still an uphill battle to get users to adopt them. This article describes how Microsoft is trying to get users to adopt them.

Netflix Tech Blog

Netflix Tech Blog has a lot of interesting articles about the technical challenges at scale. Here are a few recent ones:

This post is licensed under CC BY 4.0 by the author.