I was playing around with the Datetime.ParseExact method, and it wants an IFormatProvider...
It works inputting null, but what exactly does it do?
By MSDN
The .NET Framework includes the following three predefined IFormatProvider implementations to provide culture-specific information that is used in formatting or parsing numeric and date and time values:
NumberFormatInfo
class, which provides information that is used to format numbers, such as the currency, thousands separator, and decimal separator symbols for a particular culture. For information about the predefined format strings recognized by a NumberFormatInfo
object and used in numeric formatting operations, see Standard Numeric Format Strings and Custom Numeric Format Strings.DateTimeFormatInfo
class, which provides information that is used to format dates and times, such as the date and time separator symbols for a particular culture or the order and format of a date's year, month, and day components. For information about the predefined format strings recognized by a DateTimeFormatInfo
object and used in numeric formatting operations, see Standard Date and Time Format Strings and Custom Date and Time Format Strings.CultureInfo
class, which represents a particular culture. Its GetFormat
method returns a culture-specific NumberFormatInfo
or DateTimeFormatInfo
object, depending on whether the CultureInfo
object is used in a formatting or parsing operation that involves numbers or dates and times.The .NET Framework also supports custom formatting. This typically involves the creation of a formatting class that implements both IFormatProvider and ICustomFormatter. An instance of this class is then passed as a parameter to a method that performs a custom formatting operation, such as String.Format(IFormatProvider, String, Object[])
.
The DateTimeFormatInfo class implements this interface, so it allows you to control the formatting of your DateTime strings.