You could try a recursive approach, in which you test if the item in the array is itself an array. The for loop logic will be called if the item is iterable, and otherwise you can operate on the item for whatever you need to do. If your object implements ICollection this should be fairly simple.