|
Yes!!
Actually the question was raised by the same colleague when I told him its wrong....
|
|
|
|
|
And float and uint are also really bad...
|
|
|
|
|
Well in theory not... but our middleware doesn't support uint and float so for us (practically) they are bad.
|
|
|
|
|
That's what I call good quality, well tested code!
It's obvious it should have been:
return (double)(int)obj;
The only instant messaging I do involves my middle finger.
English doesn't borrow from other languages.
English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.
|
|
|
|
|
This would fail if obj is double...
|
|
|
|
|
In which case you make it
return (double)(int)(double)obj;
The only instant messaging I do involves my middle finger.
English doesn't borrow from other languages.
English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.
|
|
|
|
|
He likes reinventing the well or doesn't he know Convert.ToDouble()[^]?
I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p)
"Given the chance I'd rather work smart than work hard." - PHS241
"'Sophisticated platform' typically means 'I have no idea how it works.'"
|
|
|
|
|
It should be called TryConvertToDouble with the signature and semantics following the TryXXX functions like TryGetValue(), that is:
It should return bool true on successful conversion, false otherwise and the converted value in the out parameter.
|
|
|
|
|
It shouldn't exist at all.
I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p)
"Given the chance I'd rather work smart than work hard." - PHS241
"'Sophisticated platform' typically means 'I have no idea how it works.'"
|
|
|
|
|
Unboxing cannot do a representation-changing conversion.
|
|
|
|
|
|
Actually, that's designed to convert a string to double, the code in question is designed to convert objects to double - including explicitly ints.
You're not suggesting the way to convert an integer to a double is as follows are you?
1. Convert the int to a string.
2. Convert the string to a double.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
Here[^].
That is a fail.
Keep Clam And Proofread
--
√(-1) 23 ∑ π...
And it was delicious.
|
|
|
|
|
Indeed, I fail to get it
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Do not feed the troll ! - Common proverb
|
|
|
|
|
Look at the subject line.
Keep Clam And Proofread
--
√(-1) 23 ∑ π...
And it was delicious.
|
|
|
|
|
You forgot to censor your name (unless that is a fake email name).
|
|
|
|
|
I just found this wonderful tidbit in a .NET app I'm supporting.
TextBox tbRoute = (TextBox)FindControl("ChkRoute" + cnt.ToString());
if ((tbRoute.Text != "") && (tbRoute.Text != "") && (tbRoute.Text != "")) {
...
}
|
|
|
|
|
Ignoring the dubiously-named variable cnt , you must be really sure that the control ChkRouteN exists, since you never test the value returned from FindControl for null .
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
The cnt is because this was inside a for loop. Perhaps whoever coded it thought the code could lie the first two times you ask if a value is empty, but not a third.
Looking at the HTML I think they meant to find two other controls and add them to the IF statement, but never got around to it. *sigh*
|
|
|
|
|
The sad thing is that he got paid to write that...
The only instant messaging I do involves my middle finger.
English doesn't borrow from other languages.
English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.
|
|
|
|
|
So....what exactly is wrong with that?
|
|
|
|
|
Did you check that the Text property Getter didn't make changes to the underlying data and so make that a valid statement.
e.g.
private string _text;
public string Text
{
Get{
if (_text == null)
{
_text = "Empty";
return _text;
}
if (_text == "Empty")
_text = "";
return _text;
}
}
MVVM # - I did it My Way
___________________________________________
Man, you're a god. - walterhevedeich 26/05/2011
.\\axxx
(That's an 'M')
modified 9-Oct-13 2:33am.
|
|
|
|
|
_Maxxx_ wrote: if (_text = "Empty")
_text = "";
This will be always be true no matter what _text is except for F# but there the if else operation contains then
Microsoft ... the only place where VARIANT_TRUE != true
|
|
|
|
|
Thanks for the human compiler - I've fixed it.
MVVM # - I did it My Way
___________________________________________
Man, you're a god. - walterhevedeich 26/05/2011
.\\axxx
(That's an 'M')
|
|
|
|
|
No it won't. It wouldn't compile...
|
|
|
|