using System;
using System.Collections.Generic;
using System.Globalization;
namespace Kreta.Ellenorzo.Dto.VN.Utility
{
///
/// Author: Kovács Kornél (DevKornél) Created On: 2019.06.
///
public static class Extensions
{
/// UTC: 2016-10-30T20:00:00Z
/// Local: 2016-10-30T23:00:00+01:00
/// Unspecified: 2016-10-30T22:00:00
public static DateTime ToIso8601Utc(this DateTime dt)
=> new DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second, dt.Kind).ToUniversalTime();
/// UTC: 2016-10-30T20:00:00Z
/// Local: 2016-10-30T23:00:00+01:00
/// Unspecified: 2016-10-30T22:00:00
public static string ToIso8601UtcString(this DateTime dt)
=> dt.ToString("yyyy-MM-dd'T'HH:mm:ssK", CultureInfo.InvariantCulture);
public static IEnumerable ConvertAll(this IEnumerable collection, Converter converter)
{
foreach (TInput item in collection)
{
yield return converter.Invoke(item);
}
}
}
}