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

Kalle Niemitalo commented on AVRO-2857:
---------------------------------------

It would be better to add "@" so that the compiler wouldn't treat the 
identifier as a keyword. That way:

- The strings recognized by Enum.Parse(Type, string) or returned by 
Enum.ToString() would match the symbols defined in the enum schema. At least 
the ReflectDefaultReader.ReadEnum and SpecificDatumWriter<T>.ResolveEnum 
methods currently rely on this equivalence.
- If the generated C# code is compiled to an assembly and then used from some 
other programming language (e.g. F# or Visual Basic), then developers using 
that language wouldn't need to care about what keywords C# reserves. 


> 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
>         Attachments: CodeGen.cs
>
>
> 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.20.10#820010)

Reply via email to