# C1.Win.Ribbon.RibbonItemCollectionBase.BeginUpdate

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Win_Ribbon_RibbonItemCollectionBase_BeginUpdate_" data-uid="C1.Win.Ribbon.RibbonItemCollectionBase.BeginUpdate*">BeginUpdate Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Win_Ribbon_RibbonItemCollectionBase_BeginUpdate_" data-uid="C1.Win.Ribbon.RibbonItemCollectionBase.BeginUpdate*"></a>
<h4 id="C1_Win_Ribbon_RibbonItemCollectionBase_BeginUpdate" data-uid="C1.Win.Ribbon.RibbonItemCollectionBase.BeginUpdate">BeginUpdate()</h4>
<div class="markdown level1 summary"><p>Maintains performance while items are being added or removed from the collection.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void BeginUpdate()</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub BeginUpdate()</code></pre>
</div>
<h5 id="C1_Win_Ribbon_RibbonItemCollectionBase_BeginUpdate_remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>When adding a large number of items to the collection, you should use the <b>BeginUpdate</b> 
method to prevent the collection from updating its internal state each time an item is added to 
the list. Once you have completed the task of adding items to the list, call the <a class="xref" href="C1.Win.Ribbon.RibbonItemCollectionBase.EndUpdate.html#C1_Win_Ribbon_RibbonItemCollectionBase_EndUpdate">EndUpdate()</a> 
method to resume regular processing.</p> 
<p>This way of adding items dramatically improves performance and is recommended when adding 
more than 10 or 20 items to the list.</p>
</div>
<h5 id="C1_Win_Ribbon_RibbonItemCollectionBase_BeginUpdate_examples">Examples</h5>
<p>The code belows populates a <a class="xref" href="C1.Win.Ribbon.RibbonComboBox.html">RibbonComboBox</a> with items containing the names of all 
the fonts installed in the system.</p>
<p>You can run the sample as-is, then comment out the calls to <b>BeginUpdate</b> and <b>EndUpdate</b>
to see the difference in performance.</p>
<pre><code class="lang-csharp">// get collection to populate
RibbonItemCollection items = fontNameComboBox.Items;

// call BeginUpdate to suspend regular processing
items.BeginUpdate();

// populate the list
InstalledFontCollection ifc = new InstalledFontCollection();
foreach (FontFamily ff in ifc.Families)
{
    items.Add(new RibbonButton(ff.Name));
}

// resume regular processing
items.EndUpdate();</code></pre>

</div>
