Skip to content

Instantly share code, notes, and snippets.

View 0ptim's full-sized avatar
👨‍💻

0ptim 0ptim

👨‍💻
View GitHub Profile
@mrkmg
mrkmg / TimeSpanExtensions.cs
Last active January 27, 2023 12:54
C# .NET TimeSpan Rounding and Display
using System;
namespace Utils {
public static class TimeSpanExtensions
{
public static TimeSpan Round(this TimeSpan span, TimeSpanRoundingType type, MidpointRounding mode = MidpointRounding.ToEven) =>
type switch
{
TimeSpanRoundingType.QuarterMinute => TimeSpan.FromSeconds(Math.Round(span.TotalSeconds / 15, 0, mode) * 15),
@foreach (var item in new string[] { "AspNetCore","AspNet","SomeJsThingWhatever"})
{
<div>
<input type="radio" name="technology" id="@item" value="@item" @onchange="RadioSelection" checked=@(RadioValue.Equals(item,StringComparison.OrdinalIgnoreCase)) />
<label for="@item">@item</label>
</div>
}
<div>
<label>Selected Value is @RadioValue</label>
</div>