public enum RoleType
{
Supervisor,
Administrator,
User,
UserPhone,
Operator
}
I have an enum in my project and I’m going to compare a variable with these enum items!
How can I compare a variable with these items?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think i get what you are asking. You are looking for a way to iterate trough the enum values. You can do this using Enum.GetValues() that returns the int representation of the enum value.