public virtual global::System.TimeSpan ParseTimeSpan(string text, string format, global::System.IFormatProvider formatProvider)
        {
            if (string.IsNullOrEmpty(format))
                return global::System.Xml.XmlConvert.ToTimeSpan(text);

            Regex pattern;
            int[] fields;
            object[] numFormat = CreateExpression(out pattern, out fields, format, formatProvider);
            Match match = pattern.Match(text);
            if(!match.Success)
                throw new global::System.FormatException(string.Format(ResourceMessages.InvalidFormat, text));
            
            bool negate = false;
            global::System.TimeSpan value = global::System.TimeSpan.Zero;
            
            foreach(int ixfld in fields)
            {
                Group grp = match.Groups["f" + ixfld];
                if (!grp.Success) continue;
                switch (ixfld)
                {
                    case 0: //value,
                        value += global::System.TimeSpan.Parse(grp.Value);
                        break;
                    case 1: //value.Ticks,
                        value += new global::System.TimeSpan(ParseInt64(grp.Value, (string)numFormat[ixfld], formatProvider));
                        break;
                    case 2: //value.Ticks < 0 ? negSign : "",
                        negate = true; 
                        break;
                    case 3: //global::System.Math.Abs(value.Days),
                    case 8: //value.TotalDays,
                        value += global::System.TimeSpan.FromDays(ParseDouble(grp.Value, (string)numFormat[ixfld], formatProvider));
                        break;
                    case 4: //global::System.Math.Abs(value.Hours),
                    case 9: //value.TotalHours,
                        value += global::System.TimeSpan.FromHours(ParseDouble(grp.Value, (string)numFormat[ixfld], formatProvider));
                        break;
                    case 5: //global::System.Math.Abs(value.Minutes),
                    case 10: //value.TotalMinutes,
                        value += global::System.TimeSpan.FromMinutes(ParseDouble(grp.Value, (string)numFormat[ixfld], formatProvider));
                        break;
                    case 6: //global::System.Math.Abs(value.Seconds),
                    case 11: //value.TotalSeconds,
                        value += global::System.TimeSpan.FromSeconds(ParseDouble(grp.Value, (string)numFormat[ixfld], formatProvider));
                        break;
                    case 7: //global::System.Math.Abs(value.Milliseconds),
                    case 12: //value.TotalMilliseconds
                        value += global::System.TimeSpan.FromMilliseconds(ParseDouble(grp.Value, (string)numFormat[ixfld], formatProvider));
                        break;
                }
            }
            return negate ? value.Negate() : value;
        }