1
Separate file:
public enum LANG { NOT_SET = 0, ENGLISH = 1, PORTUGUESE = 2 }
File in which I want to put Enum that is currently being validated with string:
public bool Validate(StructuralData data) {
if ((int) (data.Language = GetLanguage()) <= 0)
throw new Exception(
"LANGUAGE variable not set properly, available languages:\n" +
"\"ENGLISH\" OR \"PORTUGUESE\"");
Briefly, I want to pass on what’s in Enum to what’s in string.
What I want is to be able to use the Enums, so that they can replace the string value that would be English or Portuguese, I want to put the Enum variable there and it returns me the same way in string only, through the variable.
format the part of the code to be more readable.
– Renato C.Francisco
You want to change the message to use the Enum item name instead of the "ENGLISH" and "ENGLISH" constants"?
– Jéf Bueno
as I said, the validation is being done by a string, and I want to let it being made Enum appeal.
– user220730
@Luizeradev No string validation shown in the code
– Jéf Bueno
It’s hard to understand what you want to do, you need to explain your question better.
– Peres