I have an array of datarows. I have couple of questions here:
1. Is is necessary to assign the length of the array at the design time? Can we not set it at run time.
2. Lets suppose we have set the length of the array at the design time. This needs to be changed at run time depends upon the number of elements filled in the array. Can we do that.
Please see the code attached. I have an array of datarows. I have given assigned it the length of 10 at design time. This I assume I had to because if I was leaving it blank it was giving me error saying 'Index is out of boud'. At run time I fill this array with few rows. lets suppose 2 rows. Now the initial length declared was 10 and it contains only 2 elements. How can I change the length of the array.
DataRow rowsToDel = new DataRow;
int totCols = ds.Tables.Columns.Count;
int totRows = ds.Tables.Rows.Count;
int rowDelCnt = 0;
foreach (DataRow dR in ds.Tables.Rows )
Boolean isDel = (Boolean) dR[totCols-1];
rowsToDel[rowDelCnt] = dR;