Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Hi how can i get the value of Enum by decimal number

Hi how can i get the value of Enum by decimal number

Scheduled Pinned Locked Moved C#
question
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wasimsharp
    wrote on last edited by
    #1

    i have declaer enum enum days {Saturday,sunday,monday,tuesday,wednesday,thursday,friday} Now in main function i want a loop that is been in which i can get the dat of enumuration from the integer increment; mean to sai that for(int i=0;i>10;i++) { now here when i is 2 i want to see the data of on enum at that location }

    wasim khan

    N S 2 Replies Last reply
    0
    • W wasimsharp

      i have declaer enum enum days {Saturday,sunday,monday,tuesday,wednesday,thursday,friday} Now in main function i want a loop that is been in which i can get the dat of enumuration from the integer increment; mean to sai that for(int i=0;i>10;i++) { now here when i is 2 i want to see the data of on enum at that location }

      wasim khan

      N Offline
      N Offline
      NassosReyzidis
      wrote on last edited by
      #2

      Hi there, this will return an array that you can loop: Array myArray = Enum.GetValues(typeof(YourEnum)); for the Data for the given (i) value: Enum.Parse(typeof(YourEnum),i.ToString()) Hope that helped

      Nassos

      W 2 Replies Last reply
      0
      • W wasimsharp

        i have declaer enum enum days {Saturday,sunday,monday,tuesday,wednesday,thursday,friday} Now in main function i want a loop that is been in which i can get the dat of enumuration from the integer increment; mean to sai that for(int i=0;i>10;i++) { now here when i is 2 i want to see the data of on enum at that location }

        wasim khan

        S Offline
        S Offline
        Sun Rays
        wrote on last edited by
        #3

        Hi, u can do this.. Array arr = Enum.GetValues(typeof(days)); now you can get value from arr of any position.

        Thanks, Sun Rays To get something you must have to try once. My Articles

        1 Reply Last reply
        0
        • N NassosReyzidis

          Hi there, this will return an array that you can loop: Array myArray = Enum.GetValues(typeof(YourEnum)); for the Data for the given (i) value: Enum.Parse(typeof(YourEnum),i.ToString()) Hope that helped

          Nassos

          W Offline
          W Offline
          wasimsharp
          wrote on last edited by
          #4

          :laugh:Thanx Nassos it realy work and thanx again

          wasim khan

          1 Reply Last reply
          0
          • N NassosReyzidis

            Hi there, this will return an array that you can loop: Array myArray = Enum.GetValues(typeof(YourEnum)); for the Data for the given (i) value: Enum.Parse(typeof(YourEnum),i.ToString()) Hope that helped

            Nassos

            W Offline
            W Offline
            wasimsharp
            wrote on last edited by
            #5

            Thanx Nassos it realy work and thanx again

            wasim khan

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups