什么是一个变量名前的@符号在C#是什么意思? [英] What does the @ symbol before a variable name mean in C#?

查看:163
本文介绍了什么是一个变量名前的@符号在C#是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
  <一href=\"http://stackoverflow.com/questions/91817/whats-the-use-meaning-of-the-character-in-variable-names-in-c\">What's在C#中的变量名的@符号的使用/含义?

据我了解,@符号可以将字符串改变编译器如何解析字符串前使用。但是,当一个变量名是@符号pfixed $ P $这是什么意思?

I understand that the @ symbol can be used before a string literal to change how the compiler parses the string. But what does it mean when a variable name is prefixed with the @ symbol?

推荐答案

@符号允许您使用保留字。例如:

The @ symbol allows you to use reserved word. For example:

int @class = 15;

以上的作品,当下面的不会:

The above works, when the below wouldn't:

int class = 15;

这篇关于什么是一个变量名前的@符号在C#是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆