4a89744ee9
see pt6 parser and configs for example usages
21 lines
381 B
C#
21 lines
381 B
C#
using System;
|
|
|
|
namespace SharedLibraryCore.Helpers
|
|
{
|
|
public class ParseEnum<T>
|
|
{
|
|
public static T Get(string e, Type type)
|
|
{
|
|
try
|
|
{
|
|
return (T)Enum.Parse(type, e);
|
|
}
|
|
|
|
catch (Exception)
|
|
{
|
|
return (T)(Enum.GetValues(type).GetValue(0));
|
|
}
|
|
}
|
|
}
|
|
}
|