Click here to Skip to main content
15,889,096 members
Home / Discussions / C#
   

C#

 
GeneralRe: Convert code .Net4.0 to code .Net 2.0 Pin
pmayankcodep25-Apr-16 19:32
pmayankcodep25-Apr-16 19:32 
GeneralRe: Convert code .Net4.0 to code .Net 2.0 Pin
Pete O'Hanlon25-Apr-16 21:15
mvePete O'Hanlon25-Apr-16 21:15 
GeneralRe: Convert code .Net4.0 to code .Net 2.0 Pin
pmayankcodep26-Apr-16 3:06
pmayankcodep26-Apr-16 3:06 
GeneralRe: Convert code .Net4.0 to code .Net 2.0 Pin
Member 245846727-Apr-16 13:49
Member 245846727-Apr-16 13:49 
QuestionRe: Convert code .Net4.0 to code .Net 2.0 Pin
Richard MacCutchan21-Apr-16 20:54
mveRichard MacCutchan21-Apr-16 20:54 
AnswerRe: Convert code .Net4.0 to code .Net 2.0 Pin
CHill6021-Apr-16 22:33
mveCHill6021-Apr-16 22:33 
GeneralRe: Convert code .Net4.0 to code .Net 2.0 Pin
Member 245846725-Apr-16 15:24
Member 245846725-Apr-16 15:24 
GeneralRe: Convert code .Net4.0 to code .Net 2.0 Pin
CHill6026-Apr-16 1:07
mveCHill6026-Apr-16 1:07 
GeneralRe: Convert code .Net4.0 to code .Net 2.0 Pin
Member 245846727-Apr-16 13:53
Member 245846727-Apr-16 13:53 
GeneralRe: Convert code .Net4.0 to code .Net 2.0 Pin
CHill6028-Apr-16 0:54
mveCHill6028-Apr-16 0:54 
Question'out' keyword, to use or not to use Pin
Foothill19-Apr-16 8:35
professionalFoothill19-Apr-16 8:35 
AnswerRe: 'out' keyword, to use or not to use Pin
clapclap19-Apr-16 9:05
clapclap19-Apr-16 9:05 
GeneralRe: 'out' keyword, to use or not to use Pin
Foothill19-Apr-16 9:24
professionalFoothill19-Apr-16 9:24 
GeneralRe: 'out' keyword, to use or not to use Pin
Sascha Lefèvre19-Apr-16 9:29
professionalSascha Lefèvre19-Apr-16 9:29 
GeneralRe: 'out' keyword, to use or not to use Pin
Foothill19-Apr-16 9:51
professionalFoothill19-Apr-16 9:51 
GeneralRe: 'out' keyword, to use or not to use Pin
F-ES Sitecore21-Apr-16 0:26
professionalF-ES Sitecore21-Apr-16 0:26 
AnswerRe: 'out' keyword, to use or not to use Pin
Sander Rossel19-Apr-16 11:08
professionalSander Rossel19-Apr-16 11:08 
GeneralRe: 'out' keyword, to use or not to use Pin
Foothill19-Apr-16 11:38
professionalFoothill19-Apr-16 11:38 
GeneralRe: 'out' keyword, to use or not to use Pin
Sander Rossel19-Apr-16 12:24
professionalSander Rossel19-Apr-16 12:24 
GeneralRe: 'out' keyword, to use or not to use Pin
Foothill19-Apr-16 14:06
professionalFoothill19-Apr-16 14:06 
GeneralRe: 'out' keyword, to use or not to use Pin
Sander Rossel19-Apr-16 21:25
professionalSander Rossel19-Apr-16 21:25 
GeneralRe: 'out' keyword, to use or not to use Pin
Foothill20-Apr-16 5:14
professionalFoothill20-Apr-16 5:14 
GeneralRe: 'out' keyword, to use or not to use Pin
Brisingr Aerowing20-Apr-16 4:23
professionalBrisingr Aerowing20-Apr-16 4:23 
GeneralRe: 'out' keyword, to use or not to use Pin
F-ES Sitecore21-Apr-16 0:33
professionalF-ES Sitecore21-Apr-16 0:33 
Foothill wrote:
With TryParse, it almost seems like it was designed to swallow certain exceptions and return false if they occur.


Yes it does seem that way, but that's not how TryParse works and it's important to understand that. As I mentioned above, exceptions are incredibly expensive and you should not be raising them lightly. The "Try" in TryParse doesn't mean there is an internal try\catch around the parse, it is there to indicate that it will try to do the work, but the work might fail. With Parse on its on there is no "might fail", with Parse we are saying that this operation is going to work because we know the text is of the correct format.

If you disassemble the code behind int.TryParse you will see that it verifies programmatically that the text can be converted to an int and if it detects otherwise it returns false - no exceptions or thrown or swallowed. int.TryParse is an incredibly frequently used function and if it generated exceptions internally then the resulting code would have incredibly poor performance.
GeneralRe: 'out' keyword, to use or not to use Pin
Foothill21-Apr-16 4:39
professionalFoothill21-Apr-16 4:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.