GameServerScene

GameServerScene
This commit is contained in:
ALEXTANG
2023-07-17 18:38:50 +08:00
parent da35b4306b
commit 8b26b790ee
2 changed files with 22 additions and 3 deletions

View File

@@ -26,5 +26,14 @@ namespace TEngine
}
return (T)Enum.Parse(typeof(T), str);
}
public static T Parse<T>(this string str)
{
if (!Enum.IsDefined(typeof(T), str))
{
return default(T);
}
return (T)Enum.Parse(typeof(T), str);
}
}
}