PDA

Click to See Complete Forum and Search --> : worrying


wossname
Mar 18th, 2004, 05:21 AM
Did you know you can use the word "value" as a variable name even though it is a keyword?

Is this a bug? I'm going to have to check all my old apps and make sure this hasn't occurred.

It doesnt seem to make any difference to the app but its a bit ambiguous isnt it? I didnt realise until I saw it highlighted blue by intellisense just now!

:eek:

crptcblade
Mar 18th, 2004, 06:44 AM
I don't think value is an actual keyword. If you look up "C# keywords" in help, value is not listed as one of them.

So why is it highlighted blue, you ask? I dunno.

:wave:

wossname
Mar 18th, 2004, 08:51 AM
Some structs and classes are defined as value types meaning... well I don't fully know, but I'm pretty sure you shouldn't be allowed to go around calling variables "value". That's just naughty.

:o

DevGrp
Mar 21st, 2004, 10:54 PM
Value is not really a keyword since you cant declare a variable with it. Its only use when you declare properties, thats why its ambiguous.