How do I multiply a TimeSpan object in C#? Assuming the variable duration
is a TimeSpan, I would like, for example
duration*5
But that gives me an error "operator * cannot be applied to types TimeSpan and int". Here's my current workaround
duration+duration+duration+duration+duration
But this doesn't extend to non-integer multiples, eg. duration * 3.5
TimeSpan duration = TimeSpan.FromMinutes(1);
duration = TimeSpan.FromTicks(duration.Ticks * 12);
Console.WriteLine(duration);