serilog-extensions-logging icon indicating copy to clipboard operation
serilog-extensions-logging copied to clipboard

Avoid state object enumerator allocation

Open AndreReise opened this issue 5 months ago • 0 comments
trafficstars

While using MEL logging, the state object is commonly either FormattedLogValues or LogValues. These types are private structs and implement the IReadOnlyCollection interface. So, there is no way to easily avoid boxing, but we can save enumerator object allocation by using a for-loop instead of foreach.

AndreReise avatar Jun 09 '25 15:06 AndreReise