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

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

问题描述

可能的重复:
@的用途/含义是什么C#中变量名中的字符?

我知道可以在字符串文字之前使用@ 符号来更改编译器解析字符串的方式.但是当变量名以@ 符号为前缀时,这意味着什么?

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天全站免登陆