Extension methods on rectangular arrays.
A rectangular array is a type like double[,].
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
See Also: Inherited members from object.
⊟ Public Methods
staticRows<TSource> (this TSource[,]) : IEnumerable<IEnumerable<TSource>> Converts a rectangular array into an IEnumerable<IEnumerable<TSource>>.
⊟ Rows<TSource> Generic Method
Converts a rectangular array into an IEnumerable<IEnumerable<TSource>>.
public static IEnumerable<IEnumerable<TSource>> Rows<TSource> (this TSource[,] self)⊟ Type Parameters
- TSource
- The array element type.
⊟ Parameters
- self
- A rectangular array of TSource elements.
⊟ Returns
An IEnumerable<IEnumerable<TSource>> of each element within self in row-major order.⊟ Exceptions
Type Reason ArgumentNullException self is null. ⊟ Remarks
This is particularly useful for transposing rectangular arrays, as it can be used with IEnumerableCoda.Transpose``1(IEnumerable<IEnumerable<``0>>).
C# Example int[,] s = new int[,] { {1, 2, 3}, {4, 5, 6}, {7, 8, 9}, }; IEnumerable<IEnumerable<int>> r = s.Rows(); Assert.AreEqual (3, r.Count ()); Assert.IsTrue (new[]{1,2,3}.SequenceEqual (r.ElementAt (0))); Assert.IsTrue (new[]{4,5,6}.SequenceEqual (r.ElementAt (1))); Assert.IsTrue (new[]{7,8,9}.SequenceEqual (r.ElementAt (2)));⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0