You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The compiler generates an IsSetInfo struct containing a member for each optional field in the Thrift struct. At the moment it uses a C# struct rather than a class, to match what the official compiler does. The issue with this is that it breaks the guidelines for when to use a struct in C#.
Here's an example:
publicclassUser{privateIsSetInfoisSet;privateint?_Field1;/// <summary>/// Gets information about whether each optional field has been set./// </summary>publicIsSetInfoIsSet{get{returnthis.isSet;}}publicint?Field1{get{return_Field1;}set{this._Field1=value;this.isSet.Field1=true;}}/// <summary>/// Contains an entry for each optional field, indicating whether it has been/// set or not./// </summary>publicstructIsSetInfo{publicboolField1;}}
Because of that, we should try to figure out why this decision was made, and if it makes sense to keep it as a struct, we should document the reason why. In case a struct was chosen for performance reasons, we should wait to make any changes until we have benchmarks in place so we can justify the change makes sense.
The text was updated successfully, but these errors were encountered:
The compiler generates an
IsSetInfo
struct containing a member for each optional field in the Thrift struct. At the moment it uses a C#struct
rather than aclass
, to match what the official compiler does. The issue with this is that it breaks the guidelines for when to use a struct in C#.Here's an example:
Because of that, we should try to figure out why this decision was made, and if it makes sense to keep it as a struct, we should document the reason why. In case a struct was chosen for performance reasons, we should wait to make any changes until we have benchmarks in place so we can justify the change makes sense.
The text was updated successfully, but these errors were encountered: