System.Array - How to access an occurrence or element?

  • Thread starter Thread starter ForEverLearning
  • Start date Start date
F

ForEverLearning

Guest
I am trying to create and use an array of integers that starts at 1 and end at 7.


Array A= Array.CreateInstance(typeof(int), new[] { 7 }, new[] { 1 });

//Trying to reference an occurance givs errors!!!
A[1]=1; //error

I get:

Compilation error (line 11, col 3): Cannot apply indexing with [] to an expression of type 'System.Array'

How can I resolve this. I want to use an array because I call a method that expects an array.

Continue reading...
 
Back
Top