Try Catch - at least it won't break
The Weird and The Wonderful
4
Posts
4
Posters
0
Views
1
Watching
-
Just found this piece of quality in our production code.
try { Class1.NullableInt1 = int.Parse(txtSomeUserInput.Text); } catch { Class1.NullableInt1 = null; } ... //repeat for each nullable int in the class.
NB: Class, property and input names changed to protect the inocent. And people here wonder why our web forms can take 1 minute or more to post back!
-
Just found this piece of quality in our production code.
try { Class1.NullableInt1 = int.Parse(txtSomeUserInput.Text); } catch { Class1.NullableInt1 = null; } ... //repeat for each nullable int in the class.
NB: Class, property and input names changed to protect the inocent. And people here wonder why our web forms can take 1 minute or more to post back!
Sadly, the sucker never heard of the Convert class...
-
Sadly, the sucker never heard of the Convert class...
-
Just found this piece of quality in our production code.
try { Class1.NullableInt1 = int.Parse(txtSomeUserInput.Text); } catch { Class1.NullableInt1 = null; } ... //repeat for each nullable int in the class.
NB: Class, property and input names changed to protect the inocent. And people here wonder why our web forms can take 1 minute or more to post back!