2025-06-08 00:39:11 +09:00

21 lines
402 B
C#

using System;
namespace VRM
{
public static class EnumUtil
{
public static T TryParseOrDefault<T>(string src, T defaultValue=default(T)) where T : struct
{
try
{
return (T)Enum.Parse(typeof(T), src, true);
}
catch (Exception)
{
return defaultValue;
}
}
}
}