Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# keyword-like variables

Tags:

c#

We have the following cycle in the code:

foreach (var event in events)
{
...
{

Of cources we can't name variable "event" as it is a keyword. Which way is a more appropriate in this kind of cases: to use @ prefix (@event) or to use another name like "currentEvent"?

like image 216
SiberianGuy Avatar asked Jan 20 '12 08:01

SiberianGuy


1 Answers

Definitely use another name.

The keyword variables are really cool feature of C# but they should be used for interoperability.

like image 124
Stilgar Avatar answered Sep 29 '22 23:09

Stilgar