20240223
This commit is contained in:
parent
a586c5a0f9
commit
7e8f9d07ba
15
anbs_cp/Extensions/DateTimeExtension.cs
Normal file
15
anbs_cp/Extensions/DateTimeExtension.cs
Normal file
@ -0,0 +1,15 @@
|
||||
namespace anbs_cp.Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// Расширение класса DateTime
|
||||
/// </summary>
|
||||
public static class DateTimeExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// "Обнуляет" миллисекунды
|
||||
/// </summary>
|
||||
/// <param name="dt">Дата/время</param>
|
||||
/// <returns>Дата/время с нулевыми миллисекундами</returns>
|
||||
public static DateTime TrimMilliseconds (this DateTime dt) =>
|
||||
new(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second, 0, dt.Kind);
|
||||
}
|
16
anbs_cp/Extensions/MethodInfoExtension.cs
Normal file
16
anbs_cp/Extensions/MethodInfoExtension.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System.Reflection;
|
||||
|
||||
namespace anbs_cp.Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// Расширение MethodInfo
|
||||
/// </summary>
|
||||
public static class MethodInfoExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// Проверяет, является ли метод асинхронным
|
||||
/// </summary>
|
||||
/// <param name="method">Метод</param>
|
||||
/// <returns>Асинхронный или нет</returns>
|
||||
public static bool IsAsync (this MethodInfo method) => typeof(Task) == method.ReturnType;
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Version>2024.2.11</Version>
|
||||
<Version>2024.2.23</Version>
|
||||
<Authors>Александр Бабаев</Authors>
|
||||
<Product>Набор компонентов ANB Software</Product>
|
||||
<Description>Библиотека полезных методов языка C#</Description>
|
||||
|
Loading…
x
Reference in New Issue
Block a user