If it's an array of strings, you can do something like:
string[] results = theArray.Where(s => !string.IsNullOrWhitespace(s)).ToArray();
If you are just going to iterate over the results, there is no need to convert back to an array, and you can leave .ToArray() at the end.
Edit:
If you just want to delete the last cell and not empty records (as suggested by your edited version), you can do this with Array.Copy more efficiently than with the LINQ statement above:
string[] results = new string[theArray.Length - 1]; Array.Copy( theArray, results, results.Length );
source share