# C1.WPF.FlexGrid.RowColCollection-1.DeferNotifications

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_WPF_FlexGrid_RowColCollection_1_DeferNotifications_" data-uid="C1.WPF.FlexGrid.RowColCollection`1.DeferNotifications*">DeferNotifications Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_WPF_FlexGrid_RowColCollection_1_DeferNotifications_" data-uid="C1.WPF.FlexGrid.RowColCollection`1.DeferNotifications*"></a>
<h4 id="C1_WPF_FlexGrid_RowColCollection_1_DeferNotifications" data-uid="C1.WPF.FlexGrid.RowColCollection`1.DeferNotifications">DeferNotifications()</h4>
<div class="markdown level1 summary"><p>Suspends notifications until the returned <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.idisposable">IDisposable</a>
object is disposed.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public IDisposable DeferNotifications()</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function DeferNotifications() As IDisposable</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.idisposable">IDisposable</a></td>
      <td><p>An <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.idisposable">IDisposable</a> object that must be disposed to restore notifications.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_WPF_FlexGrid_RowColCollection_1_DeferNotifications_remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>This method is typically used in update blocks to perform batch updates efficiently
and safely.</p>
</div>
<h5 id="C1_WPF_FlexGrid_RowColCollection_1_DeferNotifications_examples">Examples</h5>
<pre><code>&lt;p&gt;The example below shows how you can use the &lt;b&gt;DeferNotifications&lt;/b&gt; method to suspend
</code></pre>
<p>notifications while setting the width of several columns on the grid.</p>
<p>Note that the call to the <b>DeferNotifications</b> method is placed in a <b>using</b>
statement, which automatically disposes of the object and restores notifications
at the end of the block, even if the code within the block throws an exception.
This makes the code more readable and concise than calling the more traditional
<b>BeginUpdate</b> and <b>EndUpdate</b> methods within a try/finally block.</p>
<pre><code>&lt;pre&gt;&lt;code class=&quot;lang-csharp&quot;&gt;var grid = new C1FlexGrid();
using (grid.Columns.DeferNotifications())
{
  foreach (var col in grid.Columns)
  {
    col.Width = 100;
  }
}&lt;/code&gt;&lt;/pre&gt;
</code></pre>

</div>
