Files
WinFormDiApp/WinFormDiApp.BL/Helpers/Extensions.cs

27 lines
628 B
C#

namespace WinFormDiApp.BL.Helpers;
public static class Extensions
{
public static bool IsNumeric(this string value)
{
if (!string.IsNullOrEmpty(value))
{
if (value.All(char.IsDigit)) return true;
else return false;
}
else return false;
}
public static bool IsDate(this string value) {
if (!string.IsNullOrEmpty(value) && value.Length<20)
{
if (DateTime.TryParse(value, out DateTime date))
{
return true;
}
else return false;
}
else return false;
}
}