I have the following code. Apologise if some of it is redundant. I'm a novice using an older version of the .NET framework that forbids top-level statements.
using System;
namespace Whatever
{
public class DoesNotMatter
{
public static string MinsToHoursAndMins(int Mins)
{
var SensibleTimes = TimeSpan.FromMinutes(Mins);
return $"{(int) SensibleTimes.TotalHours}.{SensibleTimes:mm}"
}
}
}
If it weren't for the call to .TotalHours, I could make this a one-liner such as $"{TimeSpan.FromMinutes(Mins):mm}". Is there any way to do the same with .TotalHours included, even on the newest C#/.NET versions? In other words, how can I avoid declaring the SensibleTimes varible?