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

2023-11-23

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.

Link [ https://andrewlock.net/a-failed-experiment-with-interceptors-in-csharp-12-and-dotnet-8/ ]

Previous Article

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

2023-11-23

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.

Link [ https://andrewlock.net/a-failed-experiment-with-interceptors-in-csharp-12-and-dotnet-8/ ]

Copyright © 2024 All rights reserved

Rss

Atom