TryParseExact

DateRange.TryParseExact method

Converts the specified string representation of a date range to its DateRange equivalent.

public static bool TryParseExact(string input, string[] formats, IFormatProvider provider, 
    DateTimeStyles style, out DateRange result)
ParameterTypeDescription
inputStringThe string containing the range to parse.
formatsString[]An array of allowable formats of input.
providerIFormatProviderAn object that supplies culture-specific formatting information about input.
styleDateTimeStylesA bitwise combination of enumeration values that defines how to interpret the parsed date in relation to the current time zone or the current date. A typical value to specify is None.
resultDateRange&When this method returns, contains the DateRange value equivalent to the date range contained in input, if the conversion succeeded, or Default if the conversion failed. The conversion fails if the input parameter is null, is Empty, or does not contain a valid string representation of a date range. This parameter is passed uninitialized.

Return Value

true if the s parameter was converted successfully; otherwise, false.

See Also