C# structs that are designed to map to known C++ structures for the purposes of P/Invoke'ing are expected to have names that match the original C++ names. CodeFormatter should not add an "_" to those fields, even if the field's visibility is "private."
Two reasons I might put "private" on such a field:
It represents a union field and I choose to hide it and replace them with strongly typed properties that validate or assert the union discriminator.
It represents an obscure/dangerous/hard-to-marshal field that I know my library doesn't reference so I choose to mark it NYOB and have the "private" visibility enforce that.
A good rule for deciding whether a struct is an "interop type" might be to check if the author explicitly added the [StructLayout(Sequential/Explicit)] tag the struct.
C# structs that are designed to map to known C++ structures for the purposes of P/Invoke'ing are expected to have names that match the original C++ names. CodeFormatter should not add an "_" to those fields, even if the field's visibility is "private."
Two reasons I might put "private" on such a field:
A good rule for deciding whether a struct is an "interop type" might be to check if the author explicitly added the [StructLayout(Sequential/Explicit)] tag the struct.