arrays - C# List of lists (2D matrix) -


im trying implement 2d array class using list of lists. can please me implement function similar t this[int x, int y] function below elements in column given [int x,:] x column. returning array fine.

public class matrix<t> {     list<list<t>> matrix;      public matrix()     {         matrix = new list<list<t>>();     }      public void add(ienumerable<t> row)     {         list<t> newrow = new list<t>(row);         matrix.add(newrow);     }      public t this[int x, int y]     {         { return matrix[y][x]; }     } } 

or: return matrix.select(z=>z.elementatordefault(x));


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -