Skip to main content
Code Review

Return to Answer

replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

I agree with almaz almaz - a blanket catch is bad juju in just about every case. Need to know what exception(s) wind up being there. If the column doesn't exist, there should be a better, non-exceptional way of doing that:

 private void HideExcludedColumns(UltraGridBase grid)
 {
 if (_scExclusions == null) return;
 foreach (var strKey in _scExclusions)
 {
 //Set the appropriate column of the grid to hidden.
 foreach (var band in grid.DisplayLayout.Bands)
 {
 var columnIndex = band.Columns.IndexOf(strKey);
 if (columnIndex > -1)
 {
 band.Columns[columnIndex].Hidden = true;
 break;
 }
 }
 }
 }

I agree with almaz - a blanket catch is bad juju in just about every case. Need to know what exception(s) wind up being there. If the column doesn't exist, there should be a better, non-exceptional way of doing that:

 private void HideExcludedColumns(UltraGridBase grid)
 {
 if (_scExclusions == null) return;
 foreach (var strKey in _scExclusions)
 {
 //Set the appropriate column of the grid to hidden.
 foreach (var band in grid.DisplayLayout.Bands)
 {
 var columnIndex = band.Columns.IndexOf(strKey);
 if (columnIndex > -1)
 {
 band.Columns[columnIndex].Hidden = true;
 break;
 }
 }
 }
 }

I agree with almaz - a blanket catch is bad juju in just about every case. Need to know what exception(s) wind up being there. If the column doesn't exist, there should be a better, non-exceptional way of doing that:

 private void HideExcludedColumns(UltraGridBase grid)
 {
 if (_scExclusions == null) return;
 foreach (var strKey in _scExclusions)
 {
 //Set the appropriate column of the grid to hidden.
 foreach (var band in grid.DisplayLayout.Bands)
 {
 var columnIndex = band.Columns.IndexOf(strKey);
 if (columnIndex > -1)
 {
 band.Columns[columnIndex].Hidden = true;
 break;
 }
 }
 }
 }
Source Link
Jesse C. Slicer
  • 14.5k
  • 1
  • 40
  • 54

I agree with almaz - a blanket catch is bad juju in just about every case. Need to know what exception(s) wind up being there. If the column doesn't exist, there should be a better, non-exceptional way of doing that:

 private void HideExcludedColumns(UltraGridBase grid)
 {
 if (_scExclusions == null) return;
 foreach (var strKey in _scExclusions)
 {
 //Set the appropriate column of the grid to hidden.
 foreach (var band in grid.DisplayLayout.Bands)
 {
 var columnIndex = band.Columns.IndexOf(strKey);
 if (columnIndex > -1)
 {
 band.Columns[columnIndex].Hidden = true;
 break;
 }
 }
 }
 }
lang-cs

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