c# - how to remove a row from an 2-D Array -


i meet problem don't know how solve it. created 2-d array contains date , price.i want delete row datetime between 2 date.the example below, want delete third row.

date    price  01/07   10 02/07   20  empty   30 03/07   40 

here code:(i dont know why work)

for (int i=0;i<row.length;i++) {     (int j=0;j<col.length;j++)     {         if (array[row,0]=" ")         {             array[row,j]=array[row+1,j];             i++         }     } } 

if hell-bound on using arrays, can use linq query filter out results , return new array:

var data = new[] {                 new { date = "01/07", price = 10 },                 new { date = "02/07", price = 20 },                 new { date = "", price = 30 },                 new { date = "03/07", price = 40 }             };  var noblanks = (from d in data                  !string.isnullorwhitespace(d.date)                  select d).toarray(); 

which select data not have empty, null, or whitespace date items , place them in new array.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -