TryParse() статический приватный Метод

static private TryParse ( String s, DateTimeFormatInfo dtfi, DateTimeStyles styles, DateTime &result ) : bool
s String
dtfi DateTimeFormatInfo
styles DateTimeStyles
result DateTime
Результат bool
Пример #1
0
        public static bool TryParse(ReadOnlySpan <char> input, out DateTimeOffset result)
        {
            bool parsed = DateTimeParse.TryParse(input, DateTimeFormatInfo.CurrentInfo, DateTimeStyles.None, out DateTime dateResult, out TimeSpan offset);

            result = new DateTimeOffset(dateResult.Ticks, offset);
            return(parsed);
        }
Пример #2
0
        public static bool TryParse(ReadOnlySpan <char> input, IFormatProvider?formatProvider, DateTimeStyles styles, out DateTimeOffset result)
        {
            styles = ValidateStyles(styles, nameof(styles));
            bool parsed = DateTimeParse.TryParse(input, DateTimeFormatInfo.GetInstance(formatProvider), styles, out DateTime dateResult, out TimeSpan offset);

            result = new DateTimeOffset(dateResult.Ticks, offset);
            return(parsed);
        }
Пример #3
0
        public static bool TryParse(string input, out DateTimeOffset result)
        {
            TimeSpan span;

            System.DateTime time;
            bool            flag = DateTimeParse.TryParse(input, DateTimeFormatInfo.CurrentInfo, DateTimeStyles.None, out time, out span);

            result = new DateTimeOffset(time.Ticks, span);
            return(flag);
        }
Пример #4
0
        public static bool TryParse([NotNullWhen(true)] string?input, out DateTimeOffset result)
        {
            bool parsed = DateTimeParse.TryParse(input,
                                                 DateTimeFormatInfo.CurrentInfo,
                                                 DateTimeStyles.None,
                                                 out DateTime dateResult,
                                                 out TimeSpan offset);

            result = new DateTimeOffset(dateResult.Ticks, offset);
            return(parsed);
        }
Пример #5
0
        public static bool TryParse(string input, IFormatProvider formatProvider, DateTimeStyles styles, out DateTimeOffset result)
        {
            TimeSpan span;

            System.DateTime time;
            styles = ValidateStyles(styles, "styles");
            bool flag = DateTimeParse.TryParse(input, DateTimeFormatInfo.GetInstance(formatProvider), styles, out time, out span);

            result = new DateTimeOffset(time.Ticks, span);
            return(flag);
        }
Пример #6
0
        public static Boolean TryParse(String input, out DateTimeOffset result)
        {
            TimeSpan offset;
            DateTime dateResult;
            Boolean  parsed = DateTimeParse.TryParse(input,
                                                     DateTimeFormatInfo.CurrentInfo,
                                                     DateTimeStyles.None,
                                                     out dateResult,
                                                     out offset);

            result = new DateTimeOffset(dateResult.Ticks, offset);
            return(parsed);
        }
Пример #7
0
        public static Boolean TryParse(String input, IFormatProvider formatProvider, DateTimeStyles styles, out DateTimeOffset result)
        {
            styles = ValidateStyles(styles, "styles");
            TimeSpan offset;
            DateTime dateResult;
            Boolean  parsed = DateTimeParse.TryParse(input,
                                                     DateTimeFormatInfo.GetInstance(formatProvider),
                                                     styles,
                                                     out dateResult,
                                                     out offset);

            result = new DateTimeOffset(dateResult.Ticks, offset);
            return(parsed);
        }
Пример #8
0
        public static bool TryParse([NotNullWhen(true)] string?input, IFormatProvider?formatProvider, DateTimeStyles styles, out DateTimeOffset result)
        {
            styles = ValidateStyles(styles, nameof(styles));
            if (input == null)
            {
                result = default;
                return(false);
            }

            bool parsed = DateTimeParse.TryParse(input,
                                                 DateTimeFormatInfo.GetInstance(formatProvider),
                                                 styles,
                                                 out DateTime dateResult,
                                                 out TimeSpan offset);

            result = new DateTimeOffset(dateResult.Ticks, offset);
            return(parsed);
        }
Пример #9
0
        public static Boolean TryParse(String input, IFormatProvider formatProvider, DateTimeStyles styles, out DateTimeOffset result)
        {
            styles = ValidateStyles(styles, nameof(styles));
            if (input == null)
            {
                result = default(DateTimeOffset);
                return(false);
            }

            TimeSpan offset;
            DateTime dateResult;
            Boolean  parsed = DateTimeParse.TryParse(input.AsReadOnlySpan(),
                                                     DateTimeFormatInfo.GetInstance(formatProvider),
                                                     styles,
                                                     out dateResult,
                                                     out offset);

            result = new DateTimeOffset(dateResult.Ticks, offset);
            return(parsed);
        }
Пример #10
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));
 }
Пример #11
0
 public static bool TryParse(string s, out DateTime result)
 {
     return(DateTimeParse.TryParse(s, DateTimeFormatInfo.CurrentInfo, DateTimeStyles.None, out result));
 }