0

I'm having difficulties wrapping my head around two dimensional array in Swift and how to convert it to c# Xamarin iOS.

The code is the following:

/// This represents a 2 dimensional array for each section, indicating whether each block in the grid is occupied
/// It is grown dynamically as needed to fit every item into a grid
private var sectionedItemGrid: Array<Array<Array<Bool>>> = []

Is it not a 3 dimensional bool array?

What would be the c# equivalent?

I guess I should use a List instead. But what would be T exactly?

1 Answers1

0

You're right that that's 3D, not 2D. (i.e. a 2D array for each section)

Swift does not have multidimensional (rectangular) arrays, like C# offers. Only jagged arrays.

Why we have both jagged array and multidimensional array?

The closest equivalent is, as you suspected List<List<List<bool>>>.