Cybercrux

Everything is achievable through technology

One thought on “Generic

  1. Enum to string

    private static T ToEnum(string value)
    {
    return (T)Enum.Parse(typeof(T), value, true);
    }

    private string EnumToString(T enumValue)
    {
    Type typeParameterType = typeof(T);
    return Enum.GetName(typeParameterType, enumValue);
    }

Leave a comment