Spaces in C# Enums

后端 未结 3 1341
轮回少年
轮回少年 2020-12-08 16:21

Is there any way to put spaces in a C# enum constant? I\'ve read that you can do it in VB by doing this:

Public Enum EnumWithSpaces
  ConstantWithoutSpaces
         


        
3条回答
  •  自闭症患者
    2020-12-08 17:11

    CLR can handle absolutely any character in identifiers. However, C# restricts the identifier characters to those legal under the CLS, which space isn't. Same goes for VB.NET, by the way - spaces inside square brackets used to work in VB6, but they don't in VB.NET.

提交回复
热议问题