2017-10-03 18:17:35 -05:00
|
|
|
|
using System;
|
|
|
|
|
|
2018-04-08 01:44:42 -05:00
|
|
|
|
namespace SharedLibraryCore.Helpers
|
2017-10-03 18:17:35 -05:00
|
|
|
|
{
|
|
|
|
|
public class ParseEnum<T>
|
|
|
|
|
{
|
|
|
|
|
public static T Get(string e, Type type)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
return (T)Enum.Parse(type, e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
2022-01-26 10:32:16 -06:00
|
|
|
|
return (T)Enum.GetValues(type).GetValue(0);
|
2017-10-03 18:17:35 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-01-26 10:32:16 -06:00
|
|
|
|
}
|