Quick note
A failed function to parse more than 24 hours to TimeSpan
Posted in C#, on January 10, 2014 at 10:06
private static bool TryParse(string text, out TimeSpan controled)
        {
            if (TimeSpan.TryParse(text, out controled)) return true;

            var colon = text.IndexOf(':');
            if (colon == -1) return false;

            int hours;
            var substring = text.Substring(0, colon - 1);
            if (!int.TryParse(substring, out hours)) return false;

            int minutes;
            substring = text.Substring(colon);
            if (!int.TryParse(substring, out minutes)) return false;

            controled = new TimeSpan(hours, minutes, 0);
            return true;
        }

Share this code

| More

Use the link below to share the code:
HTML
BBCode