I have a datagridview where I select a selection of cells, then order them ready for processing.
var q = Dat.SelectedCells.OfType<DataGridViewCell>()
.OrderBy(x => x.RowIndex);//order selectedCells by row-index
var p = q.OfType<DataGridViewCell>().OrderBy(x => x.ColumnIndex);
var p is now a list of IOrderedEnumerable filled with datagridviewCells.
My question is: How can i get the first and last DataGridViewColumn out of p?
You can extract the index of the first and last columns from the initial cells collection: