You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
674 B

1 year ago
using System;
1 year ago
using System.ComponentModel.DataAnnotations;
using System.Reflection;
1 year ago
using System.Security.Cryptography;
using System.Text;
namespace Win.Sfs.Shared
{
public static class SharedExtensions
{
public static Guid ToGuid(this string input)
{
var hash = MD5.HashData(Encoding.UTF8.GetBytes(input));
return new Guid(hash);
}
1 year ago
public static string GetDisplayName(this Enum enumValue)
{
var type = enumValue.GetType();
var field = type.GetField(enumValue.ToString());
return field.GetCustomAttribute<DisplayAttribute>()?.Name ?? field.Name;
}
1 year ago
}
}