-
Banned
Not 'if', but '@if'
Heres a little C# trivia for you. Did you know, while you can't declare variabls/members/methods with the same names as C# keywords (if, while, try etc), you can if you prefix them with an @ (@if, @while, @try @etc).
http://msdn.microsoft.com/library/de...eywords_PG.asp
-
The better question is why would you want to?
Mezzano
-
Registered User
A good question. Thanks to English a lot of the names for keywords are only really useful for keywords. They don't describe anything at all useful in classes or data types.
-
Banned
We had a use the other day. VB.NET uses the Me keyword rather than 'this' (the justification for this is "VB PROGRAMMERS ARE STUPID"). We write C# code, which is called by our clients in a little scripting language which is really just VB.NET when we inject into a class definition and run against our business layer. Anyway, we wanted them to use the This keyword to access a business object their script was running on. So in C# we called the property @this. If we had uses just this, the code wouldn't have compiled in C#.
I don't think we got so far as testing it though, since we realised we could call it 'This' and avoid the same problems ('coz VB.NET is case stupid). But in theory I think it would work.
So in summary, I don't care whether you use it or not, and I doubt anyone ever will, I was just pointing out it's there. So there.
-
Registered User
Well it is a good thing to know. Thanks for pointing it out.
Oh and when it comes to case problems... yeah VB has to be different.
Popular pages
Recent additions