I'm defining structs to be received and sent over a communication channel between different devices and different programming languages. For that I explicitly define their layout in memory using StructLayoutAttribute (sequential, pack=1 - in case it matters).
From the documentation, I know it works when the struct contains only fields. It seems to also work for 'simple' properties (with empty get; set;). However I don't know if it's always the case.
So my question regarding StructLayoutAttribute effect on properties is divided to two:
- Do simple properties (again, empty get; set;) behave the same as fields?
- How do other properties behave, for example properties that their get is a computation over other properties? Are they ignored (since I don't see an actual data item behind them)? Do they take memory?