Blog Logo
TAGS

A failed experiment with interceptors in C# 12 and .NET 8

In this post, the author describes their attempt to add an interceptor to the NetEscapades.EnumExtensions NuGet package and the bug they discovered in the Roslyn compiler. The post explains the background of the NuGet package, discusses the slow performance of enum operations, and provides an alternative implementation using a switch statement. Benchmark results comparing the performance of the alternative implementation and the default ToString() method in .NET 6 are also included.