什么是放置一个@在C#变量名的前面呢? [英] What does placing a @ in front of a C# variable name do?

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

问题描述

我一直与一些C#的遗产code和我已经看到了很多@符号的变量名的前面。那是什么意思,或做什么?

I've been working with some C# legacy code and I've been seeing a lot of @ symbols in front of variable names. What does this signify or do?

目前我看到了很多在使用未保留的通用名称的变量前面。例如:

Currently I'm seeing it a lot in front of variables with common names that aren't reserved. E.g.:

MyProcedure(@step.LoadInstanceId, @step.ResultCode, @step.StatusCode);

鉴于一步是不是保留字

,没有任何理由,他们应该被转义?

Given that step isn't a reserved word, is there any reason that they should be escaped?

推荐答案

这只是一个方式,让声明保留的关键字作为瓦尔。

It's just a way to allow declaring reserved keywords as vars.

void Foo(int @string)

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

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