Type conversion
-
The actual code is a bit different, but the essence was that the developer who wrote it screwed up big time. Converting string to string is a bit useless in my humble opinion ;P
void SaveUserText(string userText) { string text = userText.ToString(); }
WM. What about weapons of mass-construction? "What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson My blog
-
The actual code is a bit different, but the essence was that the developer who wrote it screwed up big time. Converting string to string is a bit useless in my humble opinion ;P
void SaveUserText(string userText) { string text = userText.ToString(); }
WM. What about weapons of mass-construction? "What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson My blog
I suprised that there isn't an assert there as well. :)
void SaveUserText(string userText)
{
string text = userText.ToString();
assert ( text == userText );
}Chris Meech I am Canadian. [heard in a local bar]
-
I suprised that there isn't an assert there as well. :)
void SaveUserText(string userText)
{
string text = userText.ToString();
assert ( text == userText );
}Chris Meech I am Canadian. [heard in a local bar]
Surely that would be
void SaveUserText(string userText) { string text = userText.ToString(); assert ( (string)text.ToString() == (string)userText.ToString() ); }
Deja View - the feeling that you've seen this post before.
-
The actual code is a bit different, but the essence was that the developer who wrote it screwed up big time. Converting string to string is a bit useless in my humble opinion ;P
void SaveUserText(string userText) { string text = userText.ToString(); }
WM. What about weapons of mass-construction? "What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson My blog
There was some SQL I had to maintain a few years back where the original programmer had done something like
ToChar(ToChar(datevalue))
(I forget the exact syntax, it was RDB) several times. The guy who'd been maintaining said things like: "It's always been like that.", "It ain't broke.", and "He said it wouldn't work otherwise." I darn well fixed it anyway. With that and some other changes the program ran in ten minutes instead of forty. -
Surely that would be
void SaveUserText(string userText) { string text = userText.ToString(); assert ( (string)text.ToString() == (string)userText.ToString() ); }
Deja View - the feeling that you've seen this post before.
Oh, but of course! :doh:
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
Surely that would be
void SaveUserText(string userText) { string text = userText.ToString(); assert ( (string)text.ToString() == (string)userText.ToString() ); }
Deja View - the feeling that you've seen this post before.
-
There was some SQL I had to maintain a few years back where the original programmer had done something like
ToChar(ToChar(datevalue))
(I forget the exact syntax, it was RDB) several times. The guy who'd been maintaining said things like: "It's always been like that.", "It ain't broke.", and "He said it wouldn't work otherwise." I darn well fixed it anyway. With that and some other changes the program ran in ten minutes instead of forty.He said "It ain't broke" not "It aint slow"
-
He said "It ain't broke" not "It aint slow"