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. Why cant i do this?

Why cant i do this?

Scheduled Pinned Locked Moved C#
databasedata-structureshelpquestion
5 Posts 5 Posters 1 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.
  • O Offline
    O Offline
    ONeil Tomlinson
    wrote on last edited by
    #1

    Why cant i do this? The value of "args" will be of similar format to the value i assigned to it. Im getting a "Index was outside the bounds of the array" error static void Main(string[] args) { args[0] = "FrGbWOfvwO0="; }

    L C C D 4 Replies Last reply
    0
    • O ONeil Tomlinson

      Why cant i do this? The value of "args" will be of similar format to the value i assigned to it. Im getting a "Index was outside the bounds of the array" error static void Main(string[] args) { args[0] = "FrGbWOfvwO0="; }

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      http://msdn.microsoft.com/en-us/library/cb20e19t%28VS.80%29.aspx[^]

      1 Reply Last reply
      0
      • O ONeil Tomlinson

        Why cant i do this? The value of "args" will be of similar format to the value i assigned to it. Im getting a "Index was outside the bounds of the array" error static void Main(string[] args) { args[0] = "FrGbWOfvwO0="; }

        C Offline
        C Offline
        Calla
        wrote on last edited by
        #3

        I guess the args is not initialized with any length of you don't start your application with any arguments. Why do you want to add values to the args array inside your code anyway?

        1 Reply Last reply
        0
        • O ONeil Tomlinson

          Why cant i do this? The value of "args" will be of similar format to the value i assigned to it. Im getting a "Index was outside the bounds of the array" error static void Main(string[] args) { args[0] = "FrGbWOfvwO0="; }

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Because it would be pointless ? The args collection is passed in, and exists only inside this method, why would you have any desire to change it ?

          Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

          1 Reply Last reply
          0
          • O ONeil Tomlinson

            Why cant i do this? The value of "args" will be of similar format to the value i assigned to it. Im getting a "Index was outside the bounds of the array" error static void Main(string[] args) { args[0] = "FrGbWOfvwO0="; }

            D Offline
            D Offline
            dxlee
            wrote on last edited by
            #5

            There is no element in the array args if you don't run the program with a command-line parameter. Therefore, args[0] does not exist. 0 is out of range.

            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