Sophie

Sophie

distrib > Fedora > 14 > i386 > by-pkgid > 864d1c3c3cd8df4e3a2692faf8776e05 > files > 1000

db4o-doc-7.4-2.fc13.i686.rpm

<html>
  <head>
    <META http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Insert And Remove</title>
    <link rel="stylesheet" type="text/css" href="../../../../style.css">
  </head>
  <body>
    <div class="CommonContent">
      <div class="CommonContentArea">
        <h1>Insert And Remove</h1><script>
//We attach this function to a browser object as a variable so that if multiple of these blocks are
//present on the same page, then they will simply over-write eachother with the same function instead
//of generating a naming collision.
window.WikiCodeFormattingCopyToClipboard = function copyToClipboard(sID){
	var sContent = document.getElementById(sID).innerText;
	if( window.clipboardData && clipboardData.setData )
	{
		clipboardData.setData("Text", sContent);
	}
	else
	{
		alert("You must enable javascript access to your clipboard for this feature to work. Please referr to your browser documentation or Google search for instructions.");
	}
}
</script>
<p>When an object is inserted or removed from the list, only
the list object needs to be updated, the objects in the list are not going to
be changed. That means that for the object from the <a href="../collections_update_depth.html" class="wikiLink">previous topic</a> we will need to set update depth = 1.</p>

<p>Let's fill up the database with 2 long lists of objects:</p>


<span name="cs_wiki_filter" csw_filters="cs">

<div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">ListOperationsExample.cs: <span class="fscMemberName">FillUpDb</span></span></div><div class="fscCode"><pre ID="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080;">01</span><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/><span style="color: #0000FF;">private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> FillUpDb()
</span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_39_1235_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_39_1235_Open_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_39_1235_Closed_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_39_1235_Closed_Text').style.display='inline';"/><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_39_1235_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_39_1235_Closed_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_39_1235_Open_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_39_1235_Open_Text').style.display='inline';"/>        </span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_39_1235_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_39_1235_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">int</span><span style="color: #000000;"> listCount </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">2</span><span style="color: #000000;">;
</span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">int</span><span style="color: #000000;"> dataCount </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">50000</span><span style="color: #000000;">;
</span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            Stopwatch sw </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Stopwatch();
</span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            File.Delete(DbFile);
</span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            IObjectContainer db </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(DbFile);
</span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">try</span><span style="color: #000000;">
</span><span style="color: #008080;">09</span><span style="color: #000000;"><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_276_977_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_276_977_Open_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_276_977_Closed_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_276_977_Closed_Text').style.display='inline';"/><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_276_977_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_276_977_Closed_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_276_977_Open_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_276_977_Open_Text').style.display='inline';"/>            </span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_276_977_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_276_977_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                sw.Start();
</span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>
</span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">for</span><span style="color: #000000;"> (</span><span style="color: #0000FF;">int</span><span style="color: #000000;"> i </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">0</span><span style="color: #000000;">; i </span><span style="color: #000000;">&lt;</span><span style="color: #000000;"> listCount; i</span><span style="color: #000000;">++</span><span style="color: #000000;">)
</span><span style="color: #008080;">13</span><span style="color: #000000;"><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_375_936_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_375_936_Open_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_375_936_Closed_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_375_936_Closed_Text').style.display='inline';"/><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_375_936_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_375_936_Closed_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_375_936_Open_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_375_936_Open_Text').style.display='inline';"/>                </span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_375_936_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_375_936_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    ListObject lo </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> ListObject();
</span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    lo.Name </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800000;">&quot;</span><span style="color: #800000;">list</span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> i.ToString(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">00</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">);
</span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    </span><span style="color: #0000FF;">for</span><span style="color: #000000;"> (</span><span style="color: #0000FF;">int</span><span style="color: #000000;"> j </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">0</span><span style="color: #000000;">; j </span><span style="color: #000000;">&lt;</span><span style="color: #000000;"> dataCount; j</span><span style="color: #000000;">++</span><span style="color: #000000;">)
</span><span style="color: #008080;">17</span><span style="color: #000000;"><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_564_886_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_564_886_Open_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_564_886_Closed_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_564_886_Closed_Text').style.display='inline';"/><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_564_886_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_564_886_Closed_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_564_886_Open_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_564_886_Open_Text').style.display='inline';"/>                    </span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_564_886_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_564_886_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">18</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                        DataObject dataObject </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> DataObject();
</span><span style="color: #008080;">19</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                        dataObject.Name </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800000;">&quot;</span><span style="color: #800000;">data</span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> j.ToString(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">00000</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">);
</span><span style="color: #008080;">20</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                        dataObject.Data </span><span style="color: #000000;">=</span><span style="color: #000000;"> DateTime.Now.ToString() </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">&quot;</span><span style="color: #800000;"> ---- Data Object </span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> j.ToString(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">00000</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">);
</span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                        lo.Data.Add(dataObject);
</span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>                    }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">23</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    db.Set(lo);
</span><span style="color: #008080;">24</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>                }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">25</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                sw.Stop();
</span><span style="color: #008080;">26</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>            }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">27</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">finally</span><span style="color: #000000;">
</span><span style="color: #008080;">28</span><span style="color: #000000;"><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_1010_1053_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_1010_1053_Open_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_1010_1053_Closed_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_1010_1053_Closed_Text').style.display='inline';"/><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_1010_1053_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_1010_1053_Closed_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_1010_1053_Open_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_1010_1053_Open_Text').style.display='inline';"/>            </span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_1010_1053_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_FillUpDb_408_71_1010_1053_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">29</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                db.Close();
</span><span style="color: #008080;">30</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>            }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">31</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Completed {0} lists of {1} objects each.</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, listCount, dataCount);
</span><span style="color: #008080;">32</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Elapsed time: {0}</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, sw.Elapsed.ToString());
</span><span style="color: #008080;">33</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/>        }</span></span></div></pre></div></div>
</span>

<span name="cs_wiki_filter" csw_filters="vb">

<div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">ListOperationsExample.vb: <span class="fscMemberName">FillUpDb</span></span></div><div class="fscCode"><pre ID="..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_FillUpDb_541_71"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080;">01</span><img id="..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_FillUpDb_541_71_15_1414_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_FillUpDb_541_71_15_1414_Open_Text').style.display='none'; document.getElementById('..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_FillUpDb_541_71_15_1414_Closed_Image').style.display='inline'; document.getElementById('..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_FillUpDb_541_71_15_1414_Closed_Text').style.display='inline';"/><img id="..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_FillUpDb_541_71_15_1414_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_FillUpDb_541_71_15_1414_Closed_Text').style.display='none'; document.getElementById('..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_FillUpDb_541_71_15_1414_Open_Image').style.display='inline'; document.getElementById('..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_FillUpDb_541_71_15_1414_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Shared</span><span style="color: #000000;"> </span><span id="..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_FillUpDb_541_71_15_1414_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub FillUpDb()</span><span id="..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_FillUpDb_541_71_15_1414_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> FillUpDb()
</span><span style="color: #008080;">02</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> listCount </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Integer</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">2</span><span style="color: #000000;">
</span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> dataCount </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Integer</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">50000</span><span style="color: #000000;">
</span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> sw </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Stopwatch </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Stopwatch
</span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            File.Delete(DbFile)
</span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> db </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(DbFile)
</span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                sw.Start()
</span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> i </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Integer</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">0</span><span style="color: #000000;">
</span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">While</span><span style="color: #000000;"> i </span><span style="color: #000000;">&lt;</span><span style="color: #000000;"> listCount
</span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> lo </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> ListObject </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> ListObject
</span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    lo.Name </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800000;">&quot;</span><span style="color: #800000;">list</span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> i.ToString(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">00</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">)
</span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> j </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Integer</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">0</span><span style="color: #000000;">
</span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    </span><span style="color: #0000FF;">While</span><span style="color: #000000;"> j </span><span style="color: #000000;">&lt;</span><span style="color: #000000;"> dataCount
</span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                        </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> dataObject </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> DataObject </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> DataObject
</span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                        dataObject.Name </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800000;">&quot;</span><span style="color: #800000;">data</span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> j.ToString(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">00000</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">)
</span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                        dataObject.Data </span><span style="color: #000000;">=</span><span style="color: #000000;"> DateTime.Now.ToString </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">&quot;</span><span style="color: #800000;"> ---- Data Object </span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> j.ToString(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">00000</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">)
</span><span style="color: #008080;">18</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                        lo.Data.Add(dataObject)
</span><span style="color: #008080;">19</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                        System.Math.Min(System.Threading.Interlocked.Increment(j), j </span><span style="color: #000000;">-</span><span style="color: #000000;"> </span><span style="color: #800080;">1</span><span style="color: #000000;">)
</span><span style="color: #008080;">20</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">While</span><span style="color: #000000;">
</span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    db.Set(lo)
</span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    System.Math.Min(System.Threading.Interlocked.Increment(i), i </span><span style="color: #000000;">-</span><span style="color: #000000;"> </span><span style="color: #800080;">1</span><span style="color: #000000;">)
</span><span style="color: #008080;">23</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">While</span><span style="color: #000000;">
</span><span style="color: #008080;">24</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                sw.Stop()
</span><span style="color: #008080;">25</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Finally</span><span style="color: #000000;">
</span><span style="color: #008080;">26</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                db.Close()
</span><span style="color: #008080;">27</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">28</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Completed {0} lists of {1} objects each.</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, listCount, dataCount)
</span><span style="color: #008080;">29</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Elapsed time: {0}</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, sw.Elapsed.ToString)
</span><span style="color: #008080;">30</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/>        </span><span style="color: #0000FF;">End Sub</span></span></div></pre></div></div>
</span>
<p>We will remove an object from one list and insert it into
another:</p>

<span name="cs_wiki_filter" csw_filters="cs">

<div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">ListOperationsExample.cs: <span class="fscMemberName">RemoveInsert</span></span></div><div class="fscCode"><pre ID="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080;">01</span><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/><span style="color: #0000FF;">private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> RemoveInsert()
</span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_43_1431_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_43_1431_Open_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_43_1431_Closed_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_43_1431_Closed_Text').style.display='inline';"/><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_43_1431_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_43_1431_Closed_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_43_1431_Open_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_43_1431_Open_Text').style.display='inline';"/>        </span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_43_1431_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_43_1431_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            Stopwatch sw </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Stopwatch();
</span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>
</span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            IObjectContainer db </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(DbFile);
</span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">try</span><span style="color: #000000;">
</span><span style="color: #008080;">07</span><span style="color: #000000;"><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_182_1271_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_182_1271_Open_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_182_1271_Closed_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_182_1271_Closed_Text').style.display='inline';"/><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_182_1271_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_182_1271_Closed_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_182_1271_Open_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_182_1271_Open_Text').style.display='inline';"/>            </span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_182_1271_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_182_1271_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #008000;">//</span><span style="color: #008000;"> set activation depth to 1 for the quickest execution</span><span style="color: #008000;">
</span><span style="color: #008080;">09</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;">                db.Ext().Configure().UpdateDepth(</span><span style="color: #800080;">1</span><span style="color: #000000;">);
</span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                IList</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">ListObject</span><span style="color: #000000;">&gt;</span><span style="color: #000000;"> result </span><span style="color: #000000;">=</span><span style="color: #000000;"> db.Query</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">ListObject</span><span style="color: #000000;">&gt;</span><span style="color: #000000;">();
</span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">if</span><span style="color: #000000;"> (result.Count </span><span style="color: #000000;">==</span><span style="color: #000000;"> </span><span style="color: #800080;">2</span><span style="color: #000000;">)
</span><span style="color: #008080;">12</span><span style="color: #000000;"><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_431_1257_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_431_1257_Open_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_431_1257_Closed_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_431_1257_Closed_Text').style.display='inline';"/><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_431_1257_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_431_1257_Closed_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_431_1257_Open_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_431_1257_Open_Text').style.display='inline';"/>                </span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_431_1257_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_431_1257_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    </span><span style="color: #008000;">//</span><span style="color: #008000;"> retrieve 2 ListObjects</span><span style="color: #008000;">
</span><span style="color: #008080;">14</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;">                    ListObject lo1 </span><span style="color: #000000;">=</span><span style="color: #000000;"> result[</span><span style="color: #800080;">0</span><span style="color: #000000;">];
</span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    ListObject lo2 </span><span style="color: #000000;">=</span><span style="color: #000000;"> result[</span><span style="color: #800080;">1</span><span style="color: #000000;">];
</span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    DataObject dataObject </span><span style="color: #000000;">=</span><span style="color: #000000;"> lo1.Data[</span><span style="color: #800080;">0</span><span style="color: #000000;">];
</span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    </span><span style="color: #008000;">//</span><span style="color: #008000;"> move the first object from the first
</span><span style="color: #008080;">18</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    </span><span style="color: #008000;">//</span><span style="color: #008000;"> ListObject to the second ListObject</span><span style="color: #008000;">
</span><span style="color: #008080;">19</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;">                    lo1.Data.Remove(dataObject);
</span><span style="color: #008080;">20</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    lo2.Data.Add(dataObject);
</span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>
</span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Removed from the first list, count is {0}, setting data...</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, lo1.Data.Count);
</span><span style="color: #008080;">23</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Added to the second list, count is {0}, setting data...</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, lo2.Data.Count);
</span><span style="color: #008080;">24</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    sw.Start();
</span><span style="color: #008080;">25</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    db.Set(lo1);
</span><span style="color: #008080;">26</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    db.Set(lo2);
</span><span style="color: #008080;">27</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    db.Commit();
</span><span style="color: #008080;">28</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    sw.Stop();
</span><span style="color: #008080;">29</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>                }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">30</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>            }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">31</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">finally</span><span style="color: #000000;">
</span><span style="color: #008080;">32</span><span style="color: #000000;"><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_1304_1347_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_1304_1347_Open_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_1304_1347_Closed_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_1304_1347_Closed_Text').style.display='inline';"/><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_1304_1347_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_1304_1347_Closed_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_1304_1347_Open_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_1304_1347_Open_Text').style.display='inline';"/>            </span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_1304_1347_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_RemoveInsert_750_75_1304_1347_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">33</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                db.Close();
</span><span style="color: #008080;">34</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>            }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">35</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Storing took {0}</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, sw.Elapsed.ToString());
</span><span style="color: #008080;">36</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/>        }</span></span></div></pre></div></div>
</span>

<span name="cs_wiki_filter" csw_filters="vb">

<div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">ListOperationsExample.vb: <span class="fscMemberName">RemoveInsert</span></span></div><div class="fscCode"><pre ID="..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_RemoveInsert_887_75"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080;">01</span><img id="..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_RemoveInsert_887_75_15_1395_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_RemoveInsert_887_75_15_1395_Open_Text').style.display='none'; document.getElementById('..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_RemoveInsert_887_75_15_1395_Closed_Image').style.display='inline'; document.getElementById('..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_RemoveInsert_887_75_15_1395_Closed_Text').style.display='inline';"/><img id="..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_RemoveInsert_887_75_15_1395_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_RemoveInsert_887_75_15_1395_Closed_Text').style.display='none'; document.getElementById('..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_RemoveInsert_887_75_15_1395_Open_Image').style.display='inline'; document.getElementById('..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_RemoveInsert_887_75_15_1395_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Shared</span><span style="color: #000000;"> </span><span id="..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_RemoveInsert_887_75_15_1395_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub RemoveInsert()</span><span id="..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_RemoveInsert_887_75_15_1395_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> RemoveInsert()
</span><span style="color: #008080;">02</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> sw </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Stopwatch </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Stopwatch
</span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> db </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(DbFile)
</span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #008000;">'</span><span style="color: #008000;"> set activation depth to 1 for the quickest execution</span><span style="color: #008000;">
</span><span style="color: #008080;">06</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;">                db.Ext.Configure.UpdateDepth(</span><span style="color: #800080;">1</span><span style="color: #000000;">)
</span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> result </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IList(</span><span style="color: #0000FF;">Of</span><span style="color: #000000;"> ListObject) </span><span style="color: #000000;">=</span><span style="color: #000000;"> db.Query(</span><span style="color: #0000FF;">Of</span><span style="color: #000000;"> ListObject)()
</span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">If</span><span style="color: #000000;"> result.Count </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">2</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Then</span><span style="color: #000000;">
</span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    </span><span style="color: #008000;">'</span><span style="color: #008000;"> retrieve 2 ListObjects</span><span style="color: #008000;">
</span><span style="color: #008080;">10</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;">                    </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> lo1 </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> ListObject </span><span style="color: #000000;">=</span><span style="color: #000000;"> result(</span><span style="color: #800080;">0</span><span style="color: #000000;">)
</span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> lo2 </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> ListObject </span><span style="color: #000000;">=</span><span style="color: #000000;"> result(</span><span style="color: #800080;">1</span><span style="color: #000000;">)
</span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> dataObject </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> DataObject </span><span style="color: #000000;">=</span><span style="color: #000000;"> lo1.Data(</span><span style="color: #800080;">0</span><span style="color: #000000;">)
</span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    </span><span style="color: #008000;">'</span><span style="color: #008000;"> move the first object from the first</span><span style="color: #008000;">
</span><span style="color: #008080;">14</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;">                    </span><span style="color: #008000;">'</span><span style="color: #008000;"> ListObject to the second ListObject</span><span style="color: #008000;">
</span><span style="color: #008080;">15</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;">                    lo1.Data.Remove(dataObject)
</span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    lo2.Data.Add(dataObject)
</span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Removed from the first list, count is {0}, setting data...</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, lo1.Data.Count)
</span><span style="color: #008080;">18</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Added to the second list, count is {0}, setting data...</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, lo2.Data.Count)
</span><span style="color: #008080;">19</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    sw.Start()
</span><span style="color: #008080;">20</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    db.Set(lo1)
</span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    db.Set(lo2)
</span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    db.Commit()
</span><span style="color: #008080;">23</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    sw.Stop()
</span><span style="color: #008080;">24</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">If</span><span style="color: #000000;">
</span><span style="color: #008080;">25</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Finally</span><span style="color: #000000;">
</span><span style="color: #008080;">26</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                db.Close()
</span><span style="color: #008080;">27</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">28</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Storing took {0}</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, sw.Elapsed.ToString)
</span><span style="color: #008080;">29</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/>        </span><span style="color: #0000FF;">End Sub</span></span></div></pre></div></div>
</span>

<p>Remember, if an object is removed from the list and is not
going to be used any more, it should be deleted manually:</p>

<p><code>db.Delete(dataObject)</code></p>


<p>Let's check if the results are correct:</p>


<span name="cs_wiki_filter" csw_filters="cs">

<div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">ListOperationsExample.cs: <span class="fscMemberName">CheckResults</span></span></div><div class="fscCode"><pre ID="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080;">01</span><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/><span style="color: #0000FF;">private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> CheckResults()
</span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_43_1388_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_43_1388_Open_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_43_1388_Closed_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_43_1388_Closed_Text').style.display='inline';"/><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_43_1388_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_43_1388_Closed_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_43_1388_Open_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_43_1388_Open_Text').style.display='inline';"/>        </span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_43_1388_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_43_1388_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            Stopwatch sw </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Stopwatch();
</span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            IObjectContainer db </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(DbFile);
</span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">try</span><span style="color: #000000;">
</span><span style="color: #008080;">06</span><span style="color: #000000;"><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_181_1225_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_181_1225_Open_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_181_1225_Closed_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_181_1225_Closed_Text').style.display='inline';"/><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_181_1225_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_181_1225_Closed_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_181_1225_Open_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_181_1225_Open_Text').style.display='inline';"/>            </span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_181_1225_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_181_1225_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                IList</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">ListObject</span><span style="color: #000000;">&gt;</span><span style="color: #000000;"> result </span><span style="color: #000000;">=</span><span style="color: #000000;"> db.Query</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">ListObject</span><span style="color: #000000;">&gt;</span><span style="color: #000000;">();
</span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">if</span><span style="color: #000000;"> (result.Count </span><span style="color: #000000;">&gt;</span><span style="color: #000000;"> </span><span style="color: #800080;">0</span><span style="color: #000000;">)
</span><span style="color: #008080;">09</span><span style="color: #000000;"><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_304_1211_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_304_1211_Open_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_304_1211_Closed_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_304_1211_Closed_Text').style.display='inline';"/><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_304_1211_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_304_1211_Closed_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_304_1211_Open_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_304_1211_Open_Text').style.display='inline';"/>                </span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_304_1211_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_304_1211_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    </span><span style="color: #008000;">//</span><span style="color: #008000;"> activation depth should be enough to activate 
</span><span style="color: #008080;">11</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    </span><span style="color: #008000;">//</span><span style="color: #008000;"> ListObject, DataObject and its list members</span><span style="color: #008000;">
</span><span style="color: #008080;">12</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;">                    </span><span style="color: #0000FF;">int</span><span style="color: #000000;"> activationDepth </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">3</span><span style="color: #000000;">;
</span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    db.Ext().Configure().ActivationDepth(activationDepth);
</span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Result count was {0}, looping with activation depth {1}</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, result.Count, activationDepth);
</span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    sw.Start();
</span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    </span><span style="color: #0000FF;">foreach</span><span style="color: #000000;"> (ListObject lo </span><span style="color: #0000FF;">in</span><span style="color: #000000;"> result)
</span><span style="color: #008080;">17</span><span style="color: #000000;"><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_798_1162_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_798_1162_Open_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_798_1162_Closed_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_798_1162_Closed_Text').style.display='inline';"/><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_798_1162_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_798_1162_Closed_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_798_1162_Open_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_798_1162_Open_Text').style.display='inline';"/>                    </span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_798_1162_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_798_1162_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">18</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                        Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">ListObj {0} has {1} objects</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, lo.Name,
</span><span style="color: #008080;">19</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                            ((lo.Data </span><span style="color: #000000;">==</span><span style="color: #000000;"> </span><span style="color: #0000FF;">null</span><span style="color: #000000;">) </span><span style="color: #000000;">?</span><span style="color: #000000;"> </span><span style="color: #800000;">&quot;</span><span style="color: #800000;">&lt;null&gt;</span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> : lo.Data.Count.ToString()));
</span><span style="color: #008080;">20</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                        Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;"> --- {0} at index 0</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">,
</span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                            ((lo.Data </span><span style="color: #000000;">!=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">null</span><span style="color: #000000;"> </span><span style="color: #000000;">&amp;&amp;</span><span style="color: #000000;"> lo.Data.Count </span><span style="color: #000000;">&gt;</span><span style="color: #000000;"> </span><span style="color: #800080;">0</span><span style="color: #000000;">) </span><span style="color: #000000;">?</span><span style="color: #000000;"> lo.Data[</span><span style="color: #800080;">0</span><span style="color: #000000;">].ToString() : </span><span style="color: #800000;">&quot;</span><span style="color: #800000;">&lt;null&gt;</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">));
</span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>                    }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">23</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    sw.Stop();
</span><span style="color: #008080;">24</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>                }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">25</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>            }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">26</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">finally</span><span style="color: #000000;">
</span><span style="color: #008080;">27</span><span style="color: #000000;"><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_1258_1301_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_1258_1301_Open_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_1258_1301_Closed_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_1258_1301_Closed_Text').style.display='inline';"/><img id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_1258_1301_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_1258_1301_Closed_Text').style.display='none'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_1258_1301_Open_Image').style.display='inline'; document.getElementById('..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_1258_1301_Open_Text').style.display='inline';"/>            </span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_1258_1301_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..ListOperationsCS.ZipsListOperationsExample.Cs_ListOperationsExample.Cs_CheckResults_1251_75_1258_1301_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">28</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                db.Close();
</span><span style="color: #008080;">29</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>            }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">30</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Activation took {0}</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, sw.Elapsed.ToString());
</span><span style="color: #008080;">31</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/>        }</span></span></div></pre></div></div>
</span>

<span name="cs_wiki_filter" csw_filters="vb">


<div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">ListOperationsExample.vb: <span class="fscMemberName">CheckResults</span></span></div><div class="fscCode"><pre ID="..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_CheckResults_1390_75"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080;">01</span><img id="..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_CheckResults_1390_75_15_1343_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_CheckResults_1390_75_15_1343_Open_Text').style.display='none'; document.getElementById('..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_CheckResults_1390_75_15_1343_Closed_Image').style.display='inline'; document.getElementById('..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_CheckResults_1390_75_15_1343_Closed_Text').style.display='inline';"/><img id="..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_CheckResults_1390_75_15_1343_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_CheckResults_1390_75_15_1343_Closed_Text').style.display='none'; document.getElementById('..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_CheckResults_1390_75_15_1343_Open_Image').style.display='inline'; document.getElementById('..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_CheckResults_1390_75_15_1343_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Shared</span><span style="color: #000000;"> </span><span id="..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_CheckResults_1390_75_15_1343_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub CheckResults()</span><span id="..ListOperationsVB.ZipsListOperationsExample.Vb_ListOperationsExample.Vb_CheckResults_1390_75_15_1343_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> CheckResults()
</span><span style="color: #008080;">02</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> sw </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Stopwatch </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Stopwatch
</span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> db </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(DbFile)
</span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> result </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IList(</span><span style="color: #0000FF;">Of</span><span style="color: #000000;"> ListObject) </span><span style="color: #000000;">=</span><span style="color: #000000;"> db.Query(</span><span style="color: #0000FF;">Of</span><span style="color: #000000;"> ListObject)()
</span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">If</span><span style="color: #000000;"> result.Count </span><span style="color: #000000;">&gt;</span><span style="color: #000000;"> </span><span style="color: #800080;">0</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Then</span><span style="color: #000000;">
</span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    </span><span style="color: #008000;">'</span><span style="color: #008000;"> activation depth should be enough to activate </span><span style="color: #008000;">
</span><span style="color: #008080;">08</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;">                    </span><span style="color: #008000;">'</span><span style="color: #008000;"> ListObject, DataObject and its list members</span><span style="color: #008000;">
</span><span style="color: #008080;">09</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;">                    </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> activationDepth </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Integer</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">3</span><span style="color: #000000;">
</span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    db.Ext.Configure.ActivationDepth(activationDepth)
</span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Result count was {0}, looping with activation depth {1}</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, result.Count, activationDepth)
</span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    sw.Start()
</span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    </span><span style="color: #0000FF;">For</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Each</span><span style="color: #000000;"> lo </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> ListObject </span><span style="color: #0000FF;">In</span><span style="color: #000000;"> result
</span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                        Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">ListObj {0} has {1} objects</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, lo.Name, (Microsoft.VisualBasic.IIf((lo.Data </span><span style="color: #0000FF;">Is</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Nothing</span><span style="color: #000000;">), </span><span style="color: #800000;">&quot;</span><span style="color: #800000;">&lt;null&gt;</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, lo.Data.Count.ToString)))
</span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                        Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;"> --- {0} at index 0</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, (Microsoft.VisualBasic.IIf((</span><span style="color: #0000FF;">Not</span><span style="color: #000000;"> (lo.Data </span><span style="color: #0000FF;">Is</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Nothing</span><span style="color: #000000;">) </span><span style="color: #0000FF;">AndAlso</span><span style="color: #000000;"> lo.Data.Count </span><span style="color: #000000;">&gt;</span><span style="color: #000000;"> </span><span style="color: #800080;">0</span><span style="color: #000000;">), lo.Data(</span><span style="color: #800080;">0</span><span style="color: #000000;">).ToString, </span><span style="color: #800000;">&quot;</span><span style="color: #800000;">&lt;null&gt;</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">)))
</span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    </span><span style="color: #0000FF;">Next</span><span style="color: #000000;">
</span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    sw.Stop()
</span><span style="color: #008080;">18</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">If</span><span style="color: #000000;">
</span><span style="color: #008080;">19</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Finally</span><span style="color: #000000;">
</span><span style="color: #008080;">20</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                db.Close()
</span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Activation took {0}</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, sw.Elapsed.ToString)
</span><span style="color: #008080;">23</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/>        </span><span style="color: #0000FF;">End Sub</span></span></div></pre></div></div>

</span>

<p>You will see that insert/remove operation takes much less time with the correct update depth setting. </p></div>
    </div>
    <div id="footer">
					This revision (8) was last Modified 2007-06-15T15:56:59 by Tetyana.
				</div>
  </body>
</html>