Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the @ Sign in front of parameters [duplicate]

Possible Duplicate:
What does the @ symbol before a variable name mean in 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?

like image 481
Michal Ciechan Avatar asked Nov 04 '10 12:11

Michal Ciechan


People also ask

What does<> in c# mean?

It is a Generic Type Parameter. A generic type parameter allows you to specify an arbitrary type T to a method at compile-time, without specifying a concrete type in the method or class declaration.

What is in parameter?

An in-parameter is information being passed from the caller to the function. For small things, such as integers or real numbers, you usually use call by value for an in-parameter.

Why use discard c#?

Discards are basically temporary variables or dummy variables that are not used in application code. The main purpose of discards is to provide a reusable variable, which decreases the memory allocation and improves readability and maintainability.

What is discard task c#?

Starting with C# 7.0, C# supports discards, which are placeholder variables that are intentionally unused in application code. Discards are equivalent to unassigned variables; they don't have a value.


1 Answers

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

like image 95
Tim Robinson Avatar answered Nov 15 '22 16:11

Tim Robinson