Get int value from enum in C#

前端 未结 28 1956
臣服心动
臣服心动 2020-11-22 04:58

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

public e         


        
28条回答
  •  一生所求
    2020-11-22 05:37

    In Visual Basic, it should be:

    Public Enum Question
        Role = 2
        ProjectFunding = 3
        TotalEmployee = 4
        NumberOfServers = 5
        TopBusinessConcern = 6
    End Enum
    
    Private value As Integer = CInt(Question.Role)
    

提交回复
热议问题