struct myTime { private int hours,minutes; public int Hours {get {return this.hours;}set{this.hours=value;}} public int Minutes { get{ return minutes; } set{ minutes=value%60; hours+=value/60;}} // constructing from a string public myTime(string s) { string[] parts = s.Split( new char[] {':'} ); this.hours = int.Parse(parts[0]); this.minutes = int.Parse(parts[1]); } // constructing from hours and minutes public myTime(int hours, int minutes) { this.hours = hours; this.minutes = minutes; } // overriding string representation of this struct public override string ToString() { return String.Format( "{0}:{1}", this.Hours, this.Minutes.ToString().PadLeft(2,'0')); } // overloading the + operator to support adding two myTime structs // like adding date and integer (days) yielding a date // or subtracting date from another date yielding an integer in VFP public static myTime operator +(myTime t1, myTime t2) { int totalMins = t1.Minutes + t2.Minutes; int addHours = totalMins / 60; return new myTime( t1.Hours + t2.Hours + addHours, totalMins%60 ); } }Having a struct like that at hand you could simply do:
myTime[] times = new myTime[] { new myTime("123:15"), new myTime("50:46"), new myTime("10:50"), new myTime("1:50") }; myTime totalTime = times.Aggregate( (current,next) => current + next ); Console.WriteLine( "Total time taken to blah blah is {0}\nTotal hours was {1} and total minutes was", totalTime, totalTime.Hours, totalTime.Minutes);Cetin