Multiply is now available for TimeSpan!!!
But only for .NET Core, .NET Standard and .NET 5+.
Since .NET Core 2.0 (or .NET Standard 2.1) you can successfully run the following code:
Console.WriteLine(TimeSpan.FromSeconds(45) * 3);
// Prints:
// 00:02:15
Limitations
Nevertheless, it is important to note (as described in the docu) that this only applies for .NET Core 2.0+, .NET Standard 2.1+, and of course .NET 5+.
The code above will fail even in the latest .NET Framework version: 4.8 (which is actually the last version of .NET Framework!).
If you try the code above in a Console application, for example, running .NET Core 1.1 or lower, or .NET Framework 4.8 or lower you will be thrown the following exception:
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException:
'Operator '*' cannot be applied to operands of type 'System.TimeSpan' and 'int''
Why not in .NET Framework?
In order to try to understand why some features will be added to .Net Core but not to .NET Framework, it is enlightening to see what Immo says:
.NET Core is the open source, cross-platform, and fast-moving version of .NET. Because of its side-by-side nature it can take changes that we can’t risk applying back to .NET Framework. This means that .NET Core will get new APIs and language features over time that .NET Framework cannot. At Build we showed a demo how the file APIs are faster on .NET Core. If we put those same changes into .NET Framework we could break existing applications, and we don’t want to do that.
TimeSpan.FromTicks((long)(duration.Ticks*multiplier))
– Trussing