I have this Enum:
public enum SalaryAgreements
{
[EnumStringValue("ללא")]
Non,
[EnumStringValue("הסכם 3")]
Agree3,
[EnumStringValue("הסכם 5")]
Agree5,
}
And I need to get the "EnumStringValue". How can I do that?
I tried toString()
and:
SalaryAgreements agreement;
if ((guider.SalaryAgree != null) || (guider.SalaryAgree == 0))
{
agreement = (guider.SalaryAgree == 1 ? SalaryAgreements.Agree3 : SalaryAgreements.Agree5);
}
else
{
agreement = SalaryAgreements.Non;
}
this.salaryAgree = Enum.GetName(agreement.GetType(), agreement);
But i get only the Non
, Agree3
, Agree5
. I need the values like ללא
and הסכם
.
This is similar to Getting attributes of Enum's value, but they are working with description and I need EnumStringValue
. I wasn't able to make their examples to work.