PrepAway - Latest Free Exam Questions & Answers

What should you do?

You are developing a large .NET Framework 2.0 application that is required to provide support for culture-specific information.
You are required to parse a date and time string generated for a custom culture and to help the success of the parse operation
you designate parse patterns that tare likely to succeed.
You must additionally prevent the operation from failing whilst you select the method to use for parsing the string.
What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
The ParseExact method should be used

B.
The Parse method should be used

C.
The TryParseExact method should be used

D.
The TryParse method should be used

Explanation:
The TryParseExact method should be used if you require parsing a date and time string generated from a custom culture.
Incorrect Answers:
A, B: The usage of these methods in the scenario would be incorrect because the methods do not provide error handling
and the custom culture can be complicated and difficult to parse.
D: If you decide to use the TryParse method which attempt to parse a string using several implicit parse patterns
that may all fail you will not achieve the scenario objective.

One Comment on “What should you do?


Leave a Reply