- aggiunto un po di tutto comeil progetto del prof
This commit is contained in:
2018-09-14 19:38:02 +02:00
parent 05ce84a07a
commit c807c474c4
9698 changed files with 748393 additions and 4 deletions

View File

@@ -0,0 +1,25 @@
using System;
using System.ComponentModel;
namespace SeniorAssistant.Extensions
{
public static class EnumExtensions
{
public static string GetDescription(this Enum @enum)
{
var type = @enum.GetType();
var memInfo = type.GetMember(@enum.ToString());
if (memInfo != null && memInfo.Length > 0)
{
var attrs = memInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false);
if (attrs != null && attrs.Length > 0)
{
return ((DescriptionAttribute)attrs[0]).Description;
}
}
return @enum.ToString();
}
}
}