Skip to main content
Code Review

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

Some few thoughts without testing or anything else:

foreach(DataGridViewRow row in dgv.Rows)
{
 String cellValue = row.Cells[1].Value.ToString();
 foreach(CheckBox boxItem in boxList)
 {
 if(cellValue == boxItem.Name)
 {
 row.Visible = false;
 break;
 }
 }
}

On another sidenote, please use meaningful variable names, even in such stupid iterating loops.

Some few thoughts without testing or anything else:

  • Cache the value of the cell in a local variable.
  • Replace for-loops if possible with foreach-loops.
  • The call of boxList[x].Name.ToString() is unnecessary, it is already a String.
  • break after setting the visibility to avoid unnecessary checks.
foreach(DataGridViewRow row in dgv.Rows)
{
 String cellValue = row.Cells[1].Value.ToString();
 foreach(CheckBox boxItem in boxList)
 {
 if(cellValue == boxItem.Name)
 {
 row.Visible = false;
 break;
 }
 }
}

On another sidenote, please use meaningful variable names, even in such stupid iterating loops.

Some few thoughts without testing or anything else:

  • Cache the value of the cell in a local variable.
  • Replace for-loops if possible with foreach-loops.
  • The call of boxList[x].Name.ToString() is unnecessary, it is already a String.
  • break after setting the visibility to avoid unnecessary checks.
foreach(DataGridViewRow row in dgv.Rows)
{
 String cellValue = row.Cells[1].Value.ToString();
 foreach(CheckBox boxItem in boxList)
 {
 if(cellValue == boxItem.Name)
 {
 row.Visible = false;
 break;
 }
 }
}

On another sidenote, please use meaningful variable names, even in such stupid iterating loops.

Extended with a link.
Source Link
Bobby
  • 8.2k
  • 2
  • 35
  • 43

Some few thoughts without testing or anything else:

  • Cache the value of the cell in a local variable.
  • Replace for-loops if possible with foreach-loopsReplace for-loops if possible with foreach-loops.
  • The call of boxList[x].Name.ToString() is unnecessary, it is already a String.
  • break after setting the visibility to avoid unnecessary checks.
foreach(DataGridViewRow row in dgv.Rows)
{
 String cellValue = row.Cells[1].Value.ToString();
 foreach(CheckBox boxItem in boxList)
 {
 if(cellValue == boxItem.Name)
 {
 row.Visible = false;
 break;
 }
 }
}

On another sidenote, please use meaningful variable names, even in such stupid iterating loops.

Some few thoughts without testing or anything else:

  • Cache the value of the cell in a local variable.
  • Replace for-loops if possible with foreach-loops.
  • The call of boxList[x].Name.ToString() is unnecessary, it is already a String.
foreach(DataGridViewRow row in dgv.Rows)
{
 String cellValue = row.Cells[1].Value.ToString();
 foreach(CheckBox boxItem in boxList)
 {
 if(cellValue == boxItem.Name)
 {
 row.Visible = false;
 break;
 }
 }
}

On another sidenote, please use meaningful variable names, even in such stupid iterating loops.

Some few thoughts without testing or anything else:

  • Cache the value of the cell in a local variable.
  • Replace for-loops if possible with foreach-loops.
  • The call of boxList[x].Name.ToString() is unnecessary, it is already a String.
  • break after setting the visibility to avoid unnecessary checks.
foreach(DataGridViewRow row in dgv.Rows)
{
 String cellValue = row.Cells[1].Value.ToString();
 foreach(CheckBox boxItem in boxList)
 {
 if(cellValue == boxItem.Name)
 {
 row.Visible = false;
 break;
 }
 }
}

On another sidenote, please use meaningful variable names, even in such stupid iterating loops.

Source Link
Bobby
  • 8.2k
  • 2
  • 35
  • 43

Some few thoughts without testing or anything else:

  • Cache the value of the cell in a local variable.
  • Replace for-loops if possible with foreach-loops.
  • The call of boxList[x].Name.ToString() is unnecessary, it is already a String.
foreach(DataGridViewRow row in dgv.Rows)
{
 String cellValue = row.Cells[1].Value.ToString();
 foreach(CheckBox boxItem in boxList)
 {
 if(cellValue == boxItem.Name)
 {
 row.Visible = false;
 break;
 }
 }
}

On another sidenote, please use meaningful variable names, even in such stupid iterating loops.

lang-cs

AltStyle によって変換されたページ (->オリジナル) /