public static bool TryParseExact(string?s, string?[]?formats, IFormatProvider?provider, DateTimeStyles style, out DateTime result)
        {
            DateTimeFormatInfo.ValidateStyles(style, nameof(style));

            if (s == null)
            {
                result = default;
                return(false);
            }

            return(DateTimeParse.TryParseExactMultiple(s, formats, DateTimeFormatInfo.GetInstance(provider), style, out result));
        }
        //TODO: CHANGE INPUT AND PROVIDER TO NULLABLE IN C#8
        public static bool TryParse(string s, IFormatProvider provider, DateTimeStyles styles, out DateTime result)
        {
            DateTimeFormatInfo.ValidateStyles(styles, nameof(styles));

            if (s == null)
            {
                result = default;
                return(false);
            }

            return(DateTimeParse.TryParse(s, DateTimeFormatInfo.GetInstance(provider), styles, out result));
        }
Exemple #3
0
 public static DateTime ParseExact(String s, String[] formats, IFormatProvider provider, DateTimeStyles style)
 {
     DateTimeFormatInfo.ValidateStyles(style, "style");
     return(DateTimeParse.ParseExactMultiple(s, formats, DateTimeFormatInfo.GetInstance(provider), style));
 }
Exemple #4
0
 public static DateTime Parse(String s, IFormatProvider provider, DateTimeStyles styles)
 {
     DateTimeFormatInfo.ValidateStyles(styles, "styles");
     return(DateTimeParse.Parse(s, DateTimeFormatInfo.GetInstance(provider), styles));
 }
Exemple #5
0
 public static bool TryParseExact(string s, string[] formats, IFormatProvider provider, DateTimeStyles style, out DateTime result)
 {
     DateTimeFormatInfo.ValidateStyles(style, "style");
     return(DateTimeParse.TryParseExactMultiple(s, formats, DateTimeFormatInfo.GetInstance(provider), style, out result));
 }
Exemple #6
0
 public static bool TryParse(string s, IFormatProvider provider, DateTimeStyles styles, out DateTime result)
 {
     DateTimeFormatInfo.ValidateStyles(styles, "styles");
     return(DateTimeParse.TryParse(s, DateTimeFormatInfo.GetInstance(provider), styles, out result));
 }
 public static bool TryParseExact(ReadOnlySpan <char> s, string?[]?formats, IFormatProvider?provider, DateTimeStyles style, out DateTime result)
 {
     DateTimeFormatInfo.ValidateStyles(style, nameof(style));
     return(DateTimeParse.TryParseExactMultiple(s, formats, DateTimeFormatInfo.GetInstance(provider), style, out result));
 }
 public static bool TryParse(ReadOnlySpan <char> s, IFormatProvider?provider, DateTimeStyles styles, out DateTime result)
 {
     DateTimeFormatInfo.ValidateStyles(styles, nameof(styles));
     return(DateTimeParse.TryParse(s, DateTimeFormatInfo.GetInstance(provider), styles, out result));
 }
 public static DateTime2 ParseExact(string s, string format, IFormatProvider provider, DateTimeStyles style)
 {
     DateTimeFormatInfo.ValidateStyles(style, "style");
     return(DateTimeParse.ParseExact(s, format, DateTimeFormatInfo.GetInstance(provider), style));
 }