You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Mohammed Ali (Jira)" <ji...@apache.org> on 2020/06/03 00:48:00 UTC

[jira] [Commented] (AVRO-2857) Add an "_" as a prefix to symbols in C# enum to avoid collision with reserved keywords

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

Mohammed Ali commented on AVRO-2857:
------------------------------------

foreach (string symbol in enumschema.Symbols)
 { 
 *string new_symbol = CodeGenUtil.Instance.ReservedKeywords.Contains(symbol) ? "_" + symbol : symbol;* 
 CodeMemberField field = new CodeMemberField(typeof(int), new_symbol);
 ctd.Members.Add(field);
 }

> Add an "_" as a prefix to symbols in C# enum to avoid collision with reserved keywords
> --------------------------------------------------------------------------------------
>
>                 Key: AVRO-2857
>                 URL: https://issues.apache.org/jira/browse/AVRO-2857
>             Project: Apache Avro
>          Issue Type: Improvement
>          Components: csharp
>    Affects Versions: 1.9.2
>            Reporter: Mohammed Ali
>            Priority: Major
>
> for  the C# lang, In Avro.main\CodeGen\codegen.cs, the :
> protected virtual void processEnum(Schema schema)
> method throws an Exception if the symbol in the enum is a reserved C# keyword.
> Suggesting that the symbol should be prefixed with "_" (underscore) to avoid name collsion with a reserved keyword. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)