title: How to import from a dynamic array
body: <p>My program has to place objects on a map, i have to get the informations about the objects from a text file but my problem is that there is no limit in objects so when i write my code i don't know if someone wants to place 1 or 10 or 5 objects. Every object has a separate line where you can give the parameters for example x,y coordinates on the map to place etc etc.
  I figured out that i will ask the user to write in a line before the objects the number of objects he wants to add.Here is my example :</p>
  
  <p>txt file:</p>
  
  <p>200&lt;----not important here</p>
  
  <p>10000&lt;----not important here</p>
  
  <p>5&lt;---number of objects</p>
  
  <p>2,5/60-60&lt;--object</p>
  
  <p>4,5/70-70&lt;--object</p>
  
  <p>5,5/80-80&lt;--object</p>
  
  <p>1,1/30-30&lt;--object</p>
  
  <p>10,10/100-100&lt;--object</p>
  
  <p>10,1/5&lt;----not important here</p>
  
  <p>height,weight/x-y </p>
  
  <p>And vs throws out of range exception. Hope u understood my english and my problem</p>
  
  <pre><code>        int numberofObjects = int.Parse(data[2]);
  
          Targets[] TargetsGet = new Target[numberofObjects];
          int j = 0;
          for (int i = 4; i &lt;= numberofObjects+3; i++)
          {
  
              targets[j] = new Target(int.Parse(data[i].Split(',')[0]), int.Parse(data[i].Split('/')[0].Split(',')[1]), new Coordinate(int.Parse(data[i].Split('/')[1].Split('-')[0]),int.Parse( data[i].Split('-')[1])));
              j++;
          }
  
          return TargetsGet;
  
  
  
      }
  </code></pre>