在Enum中返回字符串值

我试图从下面的枚举模型返回参数名称。这是我的代码

using System.Text.Json.Serialization;


namespace Digital.HrAssist.Services.Models
{
    [JsonConverter(typeof(JsonStringEnumConverter))]
    public enum EExitStatusDescription
    {
        Started,
        Incomplete,
        Completed,
        Cancelled,
        SubmittedForProcessing
    }
}


return o => new EmployeeExitItem
{
      ExitId = o.ExitId,
      EmployeeId = o.EmployeeId,
      KickoffDate = o.KickoffDate,
      Action = (EExitActions)o.ActionId,
      Status = (EExitStatus)o.StatusId,
      StatusDescription = (EExitStatusDescription)o.StatusDescription
};

So I want to get the parameter names like "Started", "Incomplete" etc however I am currently getting this error "Cannot convert type 'string to 'digital.hrassist.services.models.EExitStatusDescription''"

评论