namespace OpenCvSharp.Internal.Util; /// /// Readonly rectangular array (T[,]) /// /// public class ReadOnlyArray2D { private readonly T[,] data; /// /// Constructor /// /// public ReadOnlyArray2D(T[,] data) { this.data = data ?? throw new ArgumentNullException(nameof(data)); } /// /// Indexer /// /// /// /// public ref readonly T this[int index0, int index1] => ref data[index0, index1]; /// /// Gets the total number of elements in all the dimensions of the System.Array. /// #pragma warning disable CA1721 public int Length => data.Length; #pragma warning restore CA1721 /// /// Gets a 32-bit integer that represents the number of elements in the specified dimension of the System.Array. /// /// /// public int GetLength(int dimension) => data.GetLength(dimension); /// /// Returns internal buffer /// /// public T[,] GetBuffer() => data; }