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

Carl Yeksigian commented on THRIFT-1780:
----------------------------------------

Yes, I agree.

One problem with this approach (either way) is that it doesn't handle default 
field values. That means that we can't have default values and nullable types.
Since this is a smaller set of values, might make sense to continue to generate 
__isset for those values, and use the nullable for the cases where there is no 
default value.

Autoprops are supported by mono (http://www.mono-project.com/CSharp_Compiler; 
when targeting language 3.0), so we can use the really simple properties for 
non-default values. Properties having default values should become:

{code}
private bool _Visible;

public bool? Visible
{
  get
  {
    return _Visible;
  }
  set
  {
    __isset.Visible = value.HasValue;
    if (value.HasValue) this._Visible = value.Value;
  }
}
{code}
                
> 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
>
>
> 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