mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-08 06:08:20 -05:00
20 lines
378 B
C#
20 lines
378 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);
|
|
}
|
|
}
|
|
}
|
|
} |