[ 
https://issues.apache.org/jira/browse/THRIFT-1780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13527637#comment-13527637
 ] 

Jens Geyer commented on THRIFT-1780:
------------------------------------

The C# code used to use _isset fields even for required fields. IMHO this 
is/was not completely correct, but it does not harm either. With nullables, we 
got a much different situation now:

{code}
struct SearchResultColumn {
  1 : required i32 ID,
  2 : optional bool someFlag,
  3 : optional string Key
}
{code}

becomes this:

{code}
  public partial class SearchResultColumn : TBase
  {
    public int? ID { get; set; }
    public bool? IsProductName { get; set; }
    public string Key { get; set; }
  }
{code}

It's somewhat unexpected to me, that the required ID field is a nullable. 
However, taking the entire situation into consideration and looking at the 
generated Write() methids in both cases, it was already wrong before, so we 
probably should handle that issue with another patch anyway.


                
> Add option to generate nullable values
> --------------------------------------
>
>                 Key: THRIFT-1780
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1780
>             Project: Thrift
>          Issue Type: New Feature
>          Components: C# - Compiler
>            Reporter: Carl Yeksigian
>            Priority: Minor
>         Attachments: 1780.patch, 1780-v2.patch
>
>
> There should be an option to generate nullable value types for C#.
> If a value is not set, then it would return as null rather than default 
> value. If a value is updated to null, then it would become unset.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to