0

Given:

public enum myType
{
    Val1 = 1,
    Val2 = 2,
    Val3 = 3
}

and code elsewhere in the app where a value : ... row.myType // resolves to Val1 ...

I need to translate row.myType to 1

1

4 Answers 4

1

Simply cast to an int:

int enumValue = (int)row.MyTime;
Sign up to request clarification or add additional context in comments.

Comments

0

cast it to int

(int)row.myTime

Comments

0

You can simply cast it to an integer:

(int)row.myType;

Comments

0
myType someEnumVal = myType.Val1;
int intValOfEnum = (int)someEnumVal;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.