Skip to main content
Rollback to Revision 9 - Edit approval overridden by post owner or moderator
Source Link
jim
  • 27.5k
  • 14
  • 54
  • 66

I have a class called Questions (plural). In this class there is an enum called Question (singular) which looks like this.

public enum Question
{
    Role = 2,
    ProjectFunding = 3,
    TotalEmployee = 4,
    NumberOfServers = 5,
    TopBusinessConcern = 6
}

In the Questions class, I have a get(int foo) function that returns a Questions object for that foo. Is there an easy way to get the integer value fromoff the enum so I can do something like this Questions.Get(Question.Role)?

I have a class called Questions (plural). In this class there is an enum called Question (singular) which looks like this.

public enum Question
{
    Role = 2,
    ProjectFunding = 3,
    TotalEmployee = 4,
    NumberOfServers = 5,
    TopBusinessConcern = 6
}

In the Questions class, I have a get(int foo) function that returns a Questions object for that foo. Is there an easy way to get the integer value from the enum so I can do something like Questions.Get(Question.Role)?

I have a class called Questions (plural). In this class there is an enum called Question (singular) which looks like this.

public enum Question
{
    Role = 2,
    ProjectFunding = 3,
    TotalEmployee = 4,
    NumberOfServers = 5,
    TopBusinessConcern = 6
}

In the Questions class I have a get(int foo) function that returns a Questions object for that foo. Is there an easy way to get the integer value off the enum so I can do something like this Questions.Get(Question.Role)?

I have a class called Questions (plural). In this class there is an enum called Question (singular) which looks like this.

public enum Question
{
    Role = 2,
    ProjectFunding = 3,
    TotalEmployee = 4,
    NumberOfServers = 5,
    TopBusinessConcern = 6
}

In the Questions class, I have a get(int foo) function that returns a Questions object for that foo. Is there an easy way to get the integer value offfrom the enum so I can do something like this Questions.Get(Question.Role)?

I have a class called Questions (plural). In this class there is an enum called Question (singular) which looks like this.

public enum Question
{
    Role = 2,
    ProjectFunding = 3,
    TotalEmployee = 4,
    NumberOfServers = 5,
    TopBusinessConcern = 6
}

In the Questions class I have a get(int foo) function that returns a Questions object for that foo. Is there an easy way to get the integer value off the enum so I can do something like this Questions.Get(Question.Role)?

I have a class called Questions (plural). In this class there is an enum called Question (singular) which looks like this.

public enum Question
{
    Role = 2,
    ProjectFunding = 3,
    TotalEmployee = 4,
    NumberOfServers = 5,
    TopBusinessConcern = 6
}

In the Questions class, I have a get(int foo) function that returns a Questions object for that foo. Is there an easy way to get the integer value from the enum so I can do something like Questions.Get(Question.Role)?

Add tags
Link
WonderWorker
  • 9.2k
  • 5
  • 70
  • 75

Get int value from enum in C#

Copy edited. Made it more clear that the class and the enum does not have identical spelling (which is the initial impression).
Source Link
Peter Mortensen
  • 31.5k
  • 22
  • 110
  • 134
Loading
Question Protected by Robert Levy
Loading
edited title
Link
nawfal
  • 73.7k
  • 59
  • 342
  • 379
Loading
edited the title
Link
Amar Palsapure
  • 9.7k
  • 1
  • 29
  • 46
Loading
Formatting improvements.
Source Link
Peter K.
  • 8.1k
  • 4
  • 53
  • 77
Loading
Rollback to Revision 1
Source Link
jim
  • 27.5k
  • 14
  • 54
  • 66
Loading
deleted 4 characters in body; edited tags
Source Link
Robert Harvey
  • 181.5k
  • 48
  • 349
  • 516
Loading
Source Link
jim
  • 27.5k
  • 14
  • 54
  • 66
Loading