Click here to Skip to main content
15,915,513 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
QuestionVS Designer Integration Pin
Tristan Rhodes12-Sep-07 23:38
Tristan Rhodes12-Sep-07 23:38 
AnswerRe: VS Designer Integration Pin
Dave Kreskowiak13-Sep-07 6:15
mveDave Kreskowiak13-Sep-07 6:15 
QuestionDoubts regarding Exception Throwing Pin
dreamz648012-Sep-07 22:02
dreamz648012-Sep-07 22:02 
AnswerRe: Doubts regarding Exception Throwing Pin
Pete O'Hanlon12-Sep-07 22:20
mvePete O'Hanlon12-Sep-07 22:20 
GeneralRe: Doubts regarding Exception Throwing Pin
dreamz648013-Sep-07 1:21
dreamz648013-Sep-07 1:21 
GeneralRe: Doubts regarding Exception Throwing Pin
pmarfleet13-Sep-07 1:35
pmarfleet13-Sep-07 1:35 
GeneralRe: Doubts regarding Exception Throwing Pin
Urs Enzler13-Sep-07 1:36
Urs Enzler13-Sep-07 1:36 
GeneralRe: Doubts regarding Exception Throwing Pin
Scott Dorman13-Sep-07 4:25
professionalScott Dorman13-Sep-07 4:25 
The Tryxxx pattern doesn't contradict exception handling at all. This pattern is designed for very fast testing in cases where you can take an alternative path if the value isn't valid.

For a more detailed explanation of the TryParse pattern, take a look at this blog entry:

http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx[^]

Taken from the comments on this entry:


Parse says it’s going to parse something. “Failure” means it couldn’t parse it. So exceptions from Parse could include exceptions because what you passed to it wasn’t parseable. The return value is the result of the operation—the parsed value.

TryParse says it’s going to try to parse something. “Failure” means that it wasn’t even able to try to parse the thing. Thus the only kinds of exceptions you’re going to get out of TryParse are things like OutOfMemory from JITting or allocating buffers before it even gets a chance to look at the string to be parsed. (You wouldn’t expect to get an exception because the value wasn’t parseable…the point is the method said it was going to try, and it did try. It did what it said it would, so no exception needed.) TryParse really has two results—was the thing parseable, and if so the parsed value.



Scott.

—In just two days, tomorrow will be yesterday.

[Forum Guidelines] [Articles] [Blog]

AnswerRe: Doubts regarding Exception Throwing Pin
Luc Pattyn13-Sep-07 1:45
sitebuilderLuc Pattyn13-Sep-07 1:45 
GeneralRe: Doubts regarding Exception Throwing Pin
dreamz648013-Sep-07 3:51
dreamz648013-Sep-07 3:51 
GeneralRe: Doubts regarding Exception Throwing Pin
Luc Pattyn13-Sep-07 3:55
sitebuilderLuc Pattyn13-Sep-07 3:55 
AnswerRe: Doubts regarding Exception Throwing Pin
PIEBALDconsult18-Sep-07 6:14
mvePIEBALDconsult18-Sep-07 6:14 
AnswerRe: Doubts regarding Exception Throwing Pin
brucedkyle23-Sep-07 12:32
brucedkyle23-Sep-07 12:32 
QuestionURL Behaviour Property Not Found Pin
Nagaraju_Focus12-Sep-07 19:13
Nagaraju_Focus12-Sep-07 19:13 
Question.NET assembly deployment problem Pin
ssanoj12-Sep-07 4:49
ssanoj12-Sep-07 4:49 
AnswerRe: .NET assembly deployment problem Pin
led mike12-Sep-07 5:09
led mike12-Sep-07 5:09 
QuestionCode comments in WSDL Pin
Heine2612-Sep-07 1:11
Heine2612-Sep-07 1:11 
Question32-Bit application runs faster than 64-Bit, any ideas? Pin
Ami Bar11-Sep-07 9:15
Ami Bar11-Sep-07 9:15 
AnswerRe: 32-Bit application runs faster than 64-Bit, any ideas? Pin
Luc Pattyn12-Sep-07 3:11
sitebuilderLuc Pattyn12-Sep-07 3:11 
GeneralRe: 32-Bit application runs faster than 64-Bit, any ideas? Pin
Ami Bar12-Sep-07 5:00
Ami Bar12-Sep-07 5:00 
GeneralRe: 32-Bit application runs faster than 64-Bit, any ideas? Pin
Luc Pattyn12-Sep-07 5:16
sitebuilderLuc Pattyn12-Sep-07 5:16 
GeneralRe: 32-Bit application runs faster than 64-Bit, any ideas? Pin
Ami Bar12-Sep-07 10:54
Ami Bar12-Sep-07 10:54 
QuestionThe newer shutdownTimeout in .NET 2.0 ... Pin
Vasudevan Deepak Kumar11-Sep-07 5:48
Vasudevan Deepak Kumar11-Sep-07 5:48 
GeneralRe: The newer shutdownTimeout in .NET 2.0 ... Pin
Paul Conrad31-Dec-07 9:23
professionalPaul Conrad31-Dec-07 9:23 
QuestionSqlDataAdapter.Fill(DataSet) Pin
liquid_11-Sep-07 3:51
liquid_11-Sep-07 3:51 

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.