for (int col = dataTable.Columns.Count - 1; col >= 0; col--)
{
bool removeColumn = true;
foreach(DataRow row in dataTable.Rows)
{
if (!row.IsNull(col))
{
removeColumn = false;
break;
}
}
if (removeColumn) dataTable.Columns.RemoveAt(col);
}Remove column from DataTable if all column values are NULL. Any DataTable have all column values are null then we can eliminate the same by using the following code: