mirror of
https://github.com/actions/runner.git
synced 2025-12-10 20:36:49 +00:00
GitHub Actions Runner
This commit is contained in:
18
src/Runner.Common/Util/EnumUtil.cs
Normal file
18
src/Runner.Common/Util/EnumUtil.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace GitHub.Runner.Common.Util
|
||||
{
|
||||
using System;
|
||||
|
||||
public static class EnumUtil
|
||||
{
|
||||
public static T? TryParse<T>(string value) where T: struct
|
||||
{
|
||||
T val;
|
||||
if (Enum.TryParse(value ?? string.Empty, ignoreCase: true, result: out val))
|
||||
{
|
||||
return val;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user