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. What about this gem?

What about this gem?

Scheduled Pinned Locked Moved The Weird and The Wonderful
csharprubydata-structuresquestion
6 Posts 4 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.
  • A Offline
    A Offline
    Ankush Bansal
    wrote on last edited by
    #1

    array = new T[1];
    array[array.Length - 1] = handler;

    is

    array[0]

    not allowed in c#?

    V R J 3 Replies Last reply
    0
    • A Ankush Bansal

      array = new T[1];
      array[array.Length - 1] = handler;

      is

      array[0]

      not allowed in c#?

      V Offline
      V Offline
      VallarasuS
      wrote on last edited by
      #2

      Yes you can, but someone in a near future may say it's Hard Coded!! :laugh: :laugh: :laugh:

      Regards Vallarasu S | FSharpMe.blogspot.com

      A 1 Reply Last reply
      0
      • V VallarasuS

        Yes you can, but someone in a near future may say it's Hard Coded!! :laugh: :laugh: :laugh:

        Regards Vallarasu S | FSharpMe.blogspot.com

        A Offline
        A Offline
        Ankush Bansal
        wrote on last edited by
        #3

        some might actually do. I know a person who says worlds ending soon, so lets not design!! :wtf:

        1 Reply Last reply
        0
        • A Ankush Bansal

          array = new T[1];
          array[array.Length - 1] = handler;

          is

          array[0]

          not allowed in c#?

          R Offline
          R Offline
          RobCroll
          wrote on last edited by
          #4

          An array with one element! Now that's thinking outside the box. ;)

          "You get that on the big jobs."

          A 1 Reply Last reply
          0
          • R RobCroll

            An array with one element! Now that's thinking outside the box. ;)

            "You get that on the big jobs."

            A Offline
            A Offline
            Ankush Bansal
            wrote on last edited by
            #5

            I missed to recognize that.... have my vote of 5 for "eye for detail" lol :)

            1 Reply Last reply
            0
            • A Ankush Bansal

              array = new T[1];
              array[array.Length - 1] = handler;

              is

              array[0]

              not allowed in c#?

              J Offline
              J Offline
              John Hunley
              wrote on last edited by
              #6

              Actually, that would be a very logical thing to do if the size of the array could change and the requirement was that the last element of the array be set to that particular value. If that's the case, I'd prefer the "1" to be a const int rather than hardcoded. And some comments would also be nice.

              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