This commit is contained in:
2023-06-17 14:16:09 +03:00
parent 62178f1f32
commit 7ae5d3bc81
180 changed files with 12932 additions and 192 deletions
@@ -1,5 +1,7 @@
namespace MyOffice.Core.Extensions;
using Microsoft.Extensions.Logging;
public static class StringExtensions
{
public static bool IsMissing(this string? str)
@@ -26,4 +28,28 @@ public static class StringExtensions
{
return true.ToString().Equals(str, StringComparison.OrdinalIgnoreCase) || defaultValue;
}
public static Guid AsGuid(this string str)
{
/*str = str
.Replace("_", "/")
.Replace("-", "+");
byte[] buffer = Convert.FromBase64String(str + "==");
return new Guid(buffer);*/
return Guid.Parse(str);
}
public static Guid? AsGuidNull(this string str)
{
/*str = str
.Replace("_", "/")
.Replace("-", "+");
byte[] buffer = Convert.FromBase64String(str + "==");
return new Guid(buffer);*/
if (Guid.TryParse(str, out var guid))
{
return guid;
}
return null;
}
}