System.DateTimeParse.TryParseExactMultiple C# (CSharp) Method

TryParseExactMultiple() static private method

static private TryParseExactMultiple ( String s, String formats, DateTimeFormatInfo dtfi, DateTimeStyles style, DateTime &result ) : bool
s String
formats String
dtfi DateTimeFormatInfo
style DateTimeStyles
result DateTime
return bool
        internal static bool TryParseExactMultiple(String s, String[] formats,
                                                   DateTimeFormatInfo dtfi, DateTimeStyles style, out DateTime result) {
            result = DateTime.MinValue;
            DateTimeResult resultData = new DateTimeResult();       // The buffer to store the parsing result.
            resultData.Init();
            if (TryParseExactMultiple(s, formats, dtfi, style, ref resultData)) {
                result = resultData.parsedDate;
                return true;
            }
            return false;
        }

Same methods

DateTimeParse::TryParseExactMultiple ( String s, String formats, DateTimeFormatInfo dtfi, DateTimeStyles style, DateTimeResult &result ) : bool

Usage Example

Example #1
0
        public static bool TryParseExact(
            ReadOnlySpan <char> input, [NotNullWhen(true)] string?[]?formats, IFormatProvider?formatProvider, DateTimeStyles styles, out DateTimeOffset result)
        {
            styles = ValidateStyles(styles, nameof(styles));
            bool parsed = DateTimeParse.TryParseExactMultiple(input, formats, DateTimeFormatInfo.GetInstance(formatProvider), styles, out DateTime dateResult, out TimeSpan offset);

            result = new DateTimeOffset(dateResult.Ticks, offset);
            return(parsed);
        }
All Usage Examples Of System.DateTimeParse::TryParseExactMultiple