Skip to main content
All docs
V22.2
  • CRXPF0014 - Missing BeginUpdate and EndUpdate calls

    Severity: Info

    The analyzer detects that you modify the control’s collection multiple times and do not wrap this modification into BeginUpdate and EndUpdate methods. In this case, the control may update its collection slower.

    Examples

    Invalid Code

    for ... || foreach ... || while ... || any cycle
        _gridControl.Columns.Add(_newColumn);
    
    // OR
    
    _gridControl.Columns.Add(_newColumn1);
    _gridControl.Columns.Add(_newColumn2);
    _gridControl.Columns.Remove(_someColumn);
    

    Valid Code

    _gridControl.Columns.BeginUpdate();
    for ... || foreach ... || while ... || any cycle
        _gridControl.Columns.Add(_newColumn);
    _gridControl.Columns.EndUpdate();
    
    // OR
    
    _gridControl.Columns.BeginUpdate();
    _gridControl.Columns.Add(_newColumn1);
    _gridControl.Columns.Add(_newColumn2);
    _gridControl.Columns.Remove(_someColumn);
    _gridControl.Columns.EndUpdate();
    

    How to Fix

    Call the BeginUpdate and EndUpdate methods before and after collection updates to process these updates in a batch and increase performance.