Skip to content

Instantly share code, notes, and snippets.

@BinToss
Last active July 16, 2022 23:46
Show Gist options
  • Save BinToss/4ee6f3bf7ee5532f8f4dd9c5bbff215f to your computer and use it in GitHub Desktop.
Save BinToss/4ee6f3bf7ee5532f8f4dd9c5bbff215f to your computer and use it in GitHub Desktop.
Auto-implemented properties add type-specific size to unmanaged struct as if they were fields
// Auto-implemented properties add type-specific size to unmanaged struct
/// (via Visual Studio Code extension ".NET Interactive"
struct tmp{
public nuint pp{get;set;}
}
System.Runtime.InteropServices.Marshal.SizeOf<tmp>().Display();
// 8 bytes on 64-bit runtime
// 4 bytes on 32-bit runtime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment