Source: Real-Time Innovations ( Fernando Garcia-Aranda)
The spec indicates that all members of a class or struct are mapped to read-write properties, as shown in 220.127.116.11.1:
However sequence members (IList) should map to read-only properties.
Rationale: C# best practices recommend this change: https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2227?view=vs-2019
For example, a vendor may decide to use an implementation of IList that allows accessing the memory directly (via unsafe code or Span) to optimize its serialization. If end users are allowed to completely replace the list, they may inadvertently provide a different IList| implementation that the vendor code can't serialize optimally or can't handle at all.
The same could apply to Maps.
Reported: IDL4-CSHARP 1.0a1 — Sun, 22 Mar 2020 20:10 GMT
Disposition: Resolved — IDL4-CSHARP 1.0
Making sequence members read-only properties
This resolution transforms properties resulting from mapping IDL sequence and maps struct members into read-only properties, following the C# best practices described in the issue.
It also introduces setters for Unions, where setting a sequence or a map would need to also update the discriminator value.
Updated: Mon, 29 Mar 2021 12:23 GMT