Boo.Lang.Parser.PrimitiveParser.ParseTimeSpan C# (CSharp) Метод

ParseTimeSpan() публичный статический Метод

public static ParseTimeSpan ( string text ) : System.TimeSpan
text string
Результат System.TimeSpan
        public static TimeSpan ParseTimeSpan(string text)
        {
            if (text.EndsWith("ms"))
            {
                return TimeSpan.FromMilliseconds(
                    ParseDouble(text.Substring(0, text.Length - 2)));
            }

            char last = text[text.Length - 1];
            double value = ParseDouble(text.Substring(0, text.Length - 1));
            switch (last)
            {
                case 's': return TimeSpan.FromSeconds(value);
                case 'h': return TimeSpan.FromHours(value);
                case 'm': return TimeSpan.FromMinutes(value);
                case 'd': return TimeSpan.FromDays(value);
            }
            throw new ArgumentException(text, "text");
        }