Use generic Marshal.SizeOf for known scalar types

Proprietary

Replace resolved SizeOf(Type) calls for fixed BCL scalar types with SizeOf<T>(), preserving the marshalling representation and int result. Require known .NET Framework 4.5.1+, .NET Standard 1.2+ or .NET Core 1.0+ targets with authoritative project ownership; retain type variables, user-defined types, pointers, object overloads, comments, source shadows and conditional snapshots.

OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net5.UseGenericMarshalSizeOfForScalars
mod run . --recipe=OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net5.UseGenericMarshalSizeOfForScalars

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.