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
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Interesting usage of Enumerable.Range

Interesting usage of Enumerable.Range

Scheduled Pinned Locked Moved The Weird and The Wonderful
csharpcomquestion
5 Posts 5 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.
  • L Offline
    L Offline
    leppie
    wrote on last edited by
    #1

    IEnumerable finalMarkRange = Enumerable.Range(73,2);
    if(finalMarkRange.Contains((int)Math.Round(finalMark,MidpointRounding.AwayFromZero)))
    {
    ...
    }

    :doh:

    IronScheme
    ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x)))

    B P R 3 Replies Last reply
    0
    • L leppie

      IEnumerable finalMarkRange = Enumerable.Range(73,2);
      if(finalMarkRange.Contains((int)Math.Round(finalMark,MidpointRounding.AwayFromZero)))
      {
      ...
      }

      :doh:

      IronScheme
      ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x)))

      B Offline
      B Offline
      Bernhard Hiller
      wrote on last edited by
      #2

      That's really much better to understand than

      if (finalMark < 74.5 and finalMark >= 72.5) { ... }

      Get rid of such complicated math!

      S 1 Reply Last reply
      0
      • L leppie

        IEnumerable finalMarkRange = Enumerable.Range(73,2);
        if(finalMarkRange.Contains((int)Math.Round(finalMark,MidpointRounding.AwayFromZero)))
        {
        ...
        }

        :doh:

        IronScheme
        ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x)))

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #3

        I'm guessing there's a whole series of such things?

        1 Reply Last reply
        0
        • B Bernhard Hiller

          That's really much better to understand than

          if (finalMark < 74.5 and finalMark >= 72.5) { ... }

          Get rid of such complicated math!

          S Offline
          S Offline
          Sentenryu
          wrote on last edited by
          #4

          and much slower to execute...

          I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p)

          1 Reply Last reply
          0
          • L leppie

            IEnumerable finalMarkRange = Enumerable.Range(73,2);
            if(finalMarkRange.Contains((int)Math.Round(finalMark,MidpointRounding.AwayFromZero)))
            {
            ...
            }

            :doh:

            IronScheme
            ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x)))

            R Offline
            R Offline
            Rahul Rajat Singh
            wrote on last edited by
            #5

            I think his & key was not working other wise he would have used a && to do it. poor guy.

            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