Comment Switching
-
way too much typing
My opinions are right, and yours are wrong! (or at least that is my opinion)
Are you using notepad to write code? OK, two key-presses vs. four is a win, but certainly not a lot of typing.
-
way too much typing
My opinions are right, and yours are wrong! (or at least that is my opinion)
The proper way is the right way. With intellisense and all the other editor enhancements that make life easier for developers, the "too much typing" excuse doesn't hold water. If you have issues typing, then you need to brush up on that because writing code incorrectly at the outset is just going to make a sustainment developer's job much more difficult.
I wasn't, now I am, then I won't be anymore.
-
It would be even cleverer if you used
string.Empty
instead of""
. :)"You get that on the big jobs."
Actually that wouldn't compile I think.
string.Empty
is readonly so you can't initialize a static variable with it as it could theoretically change during runtime.
-
Actually that wouldn't compile I think.
string.Empty
is readonly so you can't initialize a static variable with it as it could theoretically change during runtime.
You had me worried there for a second. I've done find replace on "" on large projects (millions of lines) and never had any adverse affects, let alone a compile error.
public static string MyString = string.Empty;
compiles for me."You get that on the big jobs."
-
You had me worried there for a second. I've done find replace on "" on large projects (millions of lines) and never had any adverse affects, let alone a compile error.
public static string MyString = string.Empty;
compiles for me."You get that on the big jobs."
Lol sorry, I actually misread and thought it was
public const string MyString = string.Empty
Sorry about that.
-
Lol sorry, I actually misread and thought it was
public const string MyString = string.Empty
Sorry about that.
-
Obscure but still worth noting. I guess at the end of the day who would set a const to equal ""?
"You get that on the big jobs."
Actually its a constant equal to string.Empty... which ahh is already what you should be using. Kinda like when you see
const bool TRUE = true;
Note: I have never actually seen this except in code horrors responding jokes.
Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.
-
way too much typing
My opinions are right, and yours are wrong! (or at least that is my opinion)
-
Obscure but still worth noting. I guess at the end of the day who would set a const to equal ""?
"You get that on the big jobs."
RobCroll wrote:
I guess at the end of the day who would set a const to equal ""?
Have you been in the Q&A recently? :)
I wasn't, now I am, then I won't be anymore.
-
How about
public static string MyString =
#if USE_MY_SPECIAL_DEBUG_VALUE
@"DEBUG VALUE"
#else
""
#endif
;Surely, this must be a lot more maintainable than a very cryptic looking comment that's going to make your successors wonder WTF?
-- Kein Mitleid Für Die Mehrheit