// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace Microsoft.VisualStudio.Services.Agent.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;
        }
    }
}