Skip to content

Commit 52031fa

Browse files
authored
Merge pull request #7322 from dotnet/timheuer-dtparsepatch
Update StringToParse section
2 parents 09e9158 + b5103ed commit 52031fa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

xml/System/DateTime.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5606,7 +5606,7 @@ juillet 2009
56065606

56075607
<a name="StringToParse"></a>
56085608
### The string to parse
5609-
The <xref:System.DateTime.Parse%2A> method tries to convert the string representation of a date and time value to its <xref:System.DateTime> equivalent. It tries to parse the input string completely without throwing a <xref:System.FormatException> exception.
5609+
The <xref:System.DateTime.Parse%2A> method tries to convert the string representation of a date and time value to its <xref:System.DateTime> equivalent. It tries to parse the input string completely without throwing a <xref:System.FormatException> exception. When using overloads that accept an <xref:System.IFormatProvider> object, it will be used to parse `StringToParse`. If no such object is provided, <xref:System.Globalization.CultureInfo.CurrentCulture> will be used instead.
56105610

56115611
> [!IMPORTANT]
56125612
> If the parsing operation fails because of an unrecognized string format, the <xref:System.DateTime.Parse%2A> method throws a <xref:System.FormatException>, whereas the <xref:System.DateTime.TryParse%2A> method returns `false`. Because exception handling can be expensive, you should use <xref:System.DateTime.Parse%2A> when the parsing operation is expected to succeed because the input source is trusted. <xref:System.DateTime.TryParse%2A> is preferable when parsing failures are likely, particularly because an input source is not trusted, or you have reasonable default values to substitute for strings that do not parse successfully.

0 commit comments

Comments
 (0)