什么是@符号在前面的参数 [英] What is the @ Sign in front of parameters

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

问题描述

可能重复:结果
什么是一个变量名前的@符号在C#是什么意思?

我在C#中被编码为约一年了,最近我遇到了以下

I have been coding in C# for about a year now, and recently i came across the following

public bool OnPreUpdate(PreUpdateEvent @event)

正如你所看到的事件面前有一个@符号,这只是为了防止编译器检测到它作为事件类型,因此并@被视为其他任何文字或者是有特殊的意义呢?

As you can see event has an '@' sign before it, is this just to prevent the compiler detecting it as the event type, therefore does '@' gets treated as any other text or is there a special meaning to it?

推荐答案

这是 @ 标志可以让你在标识符使用C#的关键字;如果删除 @ ,那么你会得到一个语法错误。

An @ sign lets you use C# keywords in identifiers; if you remove the @ then you'll get a syntax error.

这篇关于什么是@符号在前面的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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