A new way to abuse C@

time to read 2 min | 229 words

No, the the title is not a mistake, I just figured out something that should've been obvious. You can use C# to write code like this:

int @class = 0;

And the compiler will translate the name to the IL even though it's a reserved work. It stands to reason that you can also use it on non reserved words, doesn't it?

object @something = null;

The above compiles fine, and it's a very Ruby way to name a variable. What about the part about abusing the language? Well, consider this code:

string @a = "Cat";
a += @a;

There is only one variable involved here, and it's named 'a', but the @ is pretty confusing if you don't know what you're dealing with.