mirror of
https://github.com/actions/runner.git
synced 2025-12-10 12:36:23 +00:00
19 lines
385 B
C#
19 lines
385 B
C#
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;
|
|
}
|
|
}
|
|
}
|