System.Object[*] is a System.Array that is one-dimensional but not indexed starting at 0 . It is not supported in C # because C # uses 0-based indexing.
A System.Object[*] not an object[] , so you cannot use this type.
You can use:
var dataAsArray = (Array)Data;
or
var dataAsNonGenericIList = (IList)Data;
Then you can foreach .
Or you can access individual records by index, for example:
object first = dataAsArray.GetValue(1);
respectively:
object first = dataAsNonGenericIList[1];
You will need to work out the upper and lower bounds ( dataAsArray.GetLowerBound(0) , dataAsArray.GetUpperBound(0) ), but it seems that the lower bound is 1 in your case.
You can use string usual ways, (string)first if you expect it to be a string every time, or something like first as string (then check for null) if you want to support other objects.
If instead you want to copy the "weird" array into an array with index 0, see the associated stream without the number II in the header. Of course, the indices will change. For example, object[] newArray = new object[dataAsArray.Length]; dataAsArray.CopyTo(newArray, 0); object[] newArray = new object[dataAsArray.Length]; dataAsArray.CopyTo(newArray, 0);
More details :
In addition to what I wrote above, the C # dynamic function is used in the runtime binding when the actual type is System.Object[*] . This could also be done from the above question. As an example (the array I create has a rank of one, the length of a single dimension is 31 , and the lower bound in this dimension is 1 (i.e., Not zero indexing)):
dynamic Data = Array.CreateInstance(typeof(object), new[] { 31, }, new[] { 1, }); dynamic t = Data.GetType();
In any case, an InvalidCastException is InvalidCastException :
Cannot pass an object of type "System.Object [*]" to enter "System.Object []".
This is a mistake, I would say. Members exist, and I did not ask to attach to this type, I asked to be late with existing members.
The same error occurs at runtime when I execute directly from dynamic to Array or IList , as I did above in the original answer.
You can get around this error as follows:
var dataAsArray = (Array)(object)Data;
and
var dataAsNonGenericIList = (IList)(object)Data;
Drop on object with late binding (i.e. from dynamic ) does not affect the error. The next cast, from object to Array (or to IList ), is a normal application without dynamic magic, and it works, of course.
At the same time, my answer became useful (after years).
I just understand that the RoadBump response in the linked thread also gives this information, so go to the vote to respond.