Example #1
0
        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));
        }
Example #2
0
        //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));
        }
Example #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));
 }
Example #4
0
 public static DateTime Parse(String s, IFormatProvider provider, DateTimeStyles styles)
 {
     DateTimeFormatInfo.ValidateStyles(styles, "styles");
     return(DateTimeParse.Parse(s, DateTimeFormatInfo.GetInstance(provider), styles));
 }
Example #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));
 }
Example #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));
 }
Example #7
0
 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));
 }
Example #8
0
 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));
 }
Example #9
0
 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));
 }