After reading this question here: Passing one Dimension of a Two Dimensional Array in C#, I wondered whether it’s possible to use some C# 4 trickery to bind one index of a multidimensional array. Hopefully something like this:
var matrix = new int[10, 20];
var row = <some dynamic magic with matrix, 7>;
And have row being semantically identical to matrix[7] – so that row[4] is exactly matrix[7, 4].
It’s quite easy to do with functions:
int some_func(int a, string b);
var some_func_5 = (b=>some_func(5, b));
Anyone has an idea?
I don’t think you can do anything particularly C#-4-specific here. I’d personally build a specific type for it: