What's the use/meaning of the @ character in variable names in C#?

后端 未结 9 914
小蘑菇
小蘑菇 2020-11-22 01:25

I discovered that you can start your variable name with a \'@\' character in C#. In my C# project I was using a web service (I added a web reference to my project) that was

9条回答
  •  攒了一身酷
    2020-11-22 01:54

    It simply allows you to use reserved words as variable names. I wanted a var called event the other day. I was going to go with _event instead, but my colleague reminded me that I could just call it @event instead.

提交回复
热议问题