[C#] System.Array

Associate
Joined
1 Feb 2006
Posts
1,868
Location
Reading
Code:
public static void Delete(System.Array aArray, int iIndex)
        {
            ...
            for (int i = iIndex; i < iArrayLength; i++)
            {
                aArray[i] = aArray[i + 1];             
            }
            ...           
        }

Above is a snippet of code, it generates the error:

"Cannot apply indexing with [] to an expression of type 'System.Array'"

How can i get around this, it needs to be able to handle arrays of different types.
 
Please bare with me as im new to c#.

Say if you had an arraylist of objects. How would you access an elements members. Because at compile time the type of objects held by the arraylist is unknown. So if I try:

ArrayList aArray;

aArray[1].index

I get an error "'object' does not contain a definition for 'index'"

Thanks for help ppl.
 
Back
Top Bottom