<html> <head> <META http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>.NET Example Class</title> <link rel="stylesheet" type="text/css" href="../../../style.css"> </head> <body> <div class="CommonContent"> <div class="CommonContentArea"> <h1>.NET Example Class</h1><div id="TOC"><div id="TOCinner"><span class="TOCtitle">Contents</span><div class="TOCcontents"><ul><li><a href ="#Using The Constructor ">Using The Constructor </a></li><li><a href ="#Bypassing The Constructor ">Bypassing The Constructor </a></li></ul></li></ul></div></div></div><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><font color="#990000">This topic applies to .NET version only.</font> </p><p>For this example we'll be using a hypothetical <code>LocalizedItemList</code> class which binds together culture<br>information with a list of items.</p><p><code>System.Globalization.CultureInfo</code> is particularly interesting because it internally holds a native pointer<br>to a system structure which in turn cannot be cleanly stored by db4o.</p><p><span name="cs_wiki_filter" csw_filters="cs"> </p><div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">LocalizedItemList.cs</span></div><div class="fscCode"><pre ID="..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">01</span><img id="..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_0_67_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_0_67_Open_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_0_67_Closed_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_0_67_Closed_Text').style.display='inline';"/><img id="..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_0_67_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_0_67_Closed_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_0_67_Open_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_0_67_Open_Text').style.display='inline';"/><span id="..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_0_67_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">/**/</span><span id="..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_0_67_Open_Text"><span style="color: #008000;">/*</span><span style="color: #008000;"> Copyright (C) 2004 - 2007 db4objects Inc. </span><span style="color: #008000; text-decoration: underline;">http://www.db4o.com</span><span style="color: #008000;"> </span><span style="color: #008000;">*/</span></span><span style="color: #000000;"> </span><span style="color: #008080;">02</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/></span><span style="color: #0000FF;">using</span><span style="color: #000000;"> System.Globalization; </span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/> </span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/></span><span style="color: #0000FF;">namespace</span><span style="color: #000000;"> Db4objects.Db4odoc.Translators </span><span style="color: #008080;">05</span><span style="color: #000000;"><img id="..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_138_551_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_138_551_Open_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_138_551_Closed_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_138_551_Closed_Text').style.display='inline';"/><img id="..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_138_551_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_138_551_Closed_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_138_551_Open_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_138_551_Open_Text').style.display='inline';"/></span><span id="..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_138_551_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_138_551_Open_Text"><span style="color: #000000;">{ </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;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">class</span><span style="color: #000000;"> LocalizedItemList </span><span style="color: #008080;">07</span><span style="color: #000000;"><img id="..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_179_549_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_179_549_Open_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_179_549_Closed_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_179_549_Closed_Text').style.display='inline';"/><img id="..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_179_549_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_179_549_Closed_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_179_549_Open_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_179_549_Open_Text').style.display='inline';"/> </span><span id="..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_179_549_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_179_549_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"/> CultureInfo _culture; </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;">string</span><span style="color: #000000;">[] _items; </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: #008080;">11</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> LocalizedItemList(CultureInfo culture, </span><span style="color: #0000FF;">string</span><span style="color: #000000;">[] items) </span><span style="color: #008080;">12</span><span style="color: #000000;"><img id="..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_315_386_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_315_386_Open_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_315_386_Closed_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_315_386_Closed_Text').style.display='inline';"/><img id="..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_315_386_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_315_386_Closed_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_315_386_Open_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_315_386_Open_Text').style.display='inline';"/> </span><span id="..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_315_386_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_315_386_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"/> _culture </span><span style="color: #000000;">=</span><span style="color: #000000;"> culture; </span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> _items </span><span style="color: #000000;">=</span><span style="color: #000000;"> items; </span><span style="color: #008080;">15</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;">16</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </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: #0000FF;">override</span><span style="color: #000000;"> </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">string</span><span style="color: #000000;"> ToString() </span><span style="color: #008080;">18</span><span style="color: #000000;"><img id="..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_438_543_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_438_543_Open_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_438_543_Closed_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_438_543_Closed_Text').style.display='inline';"/><img id="..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_438_543_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_438_543_Closed_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_438_543_Open_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_438_543_Open_Text').style.display='inline';"/> </span><span id="..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_438_543_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..TranslatorsCS.ZipsLocalizedItemList.Cs_LocalizedItemList.Cs_494_51_438_543_Open_Text"><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;">return</span><span style="color: #000000;"> </span><span style="color: #0000FF;">string</span><span style="color: #000000;">.Join(</span><span style="color: #0000FF;">string</span><span style="color: #000000;">.Concat(_culture.TextInfo.ListSeparator, </span><span style="color: #800000;">"</span><span style="color: #800000;"> </span><span style="color: #800000;">"</span><span style="color: #000000;">), _items); </span><span style="color: #008080;">20</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;">21</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;">22</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/>}</span></span></div></pre></div></div> </p><p></span> </p><p><span name="cs_wiki_filter" csw_filters="vb"> </p><div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">LocalizedItemList.vb</span></div><div class="fscCode"><pre ID="..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51"><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: #008000;">'</span><span style="color: #008000;"> Copyright (C) 2004 - 2007 db4objects Inc. http://www.db4o.com </span><span style="color: #008000;"> </span><span style="color: #008080;">02</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/></span><span style="color: #0000FF;">Imports</span><span style="color: #000000;"> System.Globalization </span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/> </span><span style="color: #008080;">04</span><span style="color: #000000;"><img id="..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_95_771_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_95_771_Open_Text').style.display='none'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_95_771_Closed_Image').style.display='inline'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_95_771_Closed_Text').style.display='inline';"/><img id="..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_95_771_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_95_771_Closed_Text').style.display='none'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_95_771_Open_Image').style.display='inline'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_95_771_Open_Text').style.display='inline';"/></span><span id="..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_95_771_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Namespace Db4objects</span><span id="..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_95_771_Open_Text"><span style="color: #0000FF;">Namespace</span><span style="color: #000000;"> Db4objects.Db4odoc.Translators </span><span style="color: #008080;">05</span><span style="color: #000000;"><img id="..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_140_300_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_140_300_Open_Text').style.display='none'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_140_300_Closed_Image').style.display='inline'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_140_300_Closed_Text').style.display='inline';"/><img id="..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_140_300_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_140_300_Closed_Text').style.display='none'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_140_300_Open_Image').style.display='inline'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_140_300_Open_Text').style.display='inline';"/> </span><span id="..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_140_300_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">/**/</span><span id="..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_140_300_Open_Text"><span style="color: #808080;">'''</span><span style="color: #008000;"> </span><span style="color: #808080;"><summary></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: #808080;">'''</span><span style="color: #008000;"> A CultureInfo aware list of objects. </span><span style="color: #008080;">07</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #808080;">'''</span><span style="color: #008000;"> CultureInfo objects hold a native pointer to </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: #808080;">'''</span><span style="color: #008000;"> a system structure. </span><span style="color: #008080;">09</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> </span><span style="color: #808080;">'''</span><span style="color: #008000;"> </span><span style="color: #808080;"></summary></span><span style="color: #808080;"></span></span> <span style="color: #008080;">10</span><img id="..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_311_757_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_311_757_Open_Text').style.display='none'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_311_757_Closed_Image').style.display='inline'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_311_757_Closed_Text').style.display='inline';"/><img id="..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_311_757_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_311_757_Closed_Text').style.display='none'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_311_757_Open_Image').style.display='inline'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_311_757_Open_Text').style.display='inline';"/><span style="color: #000000;"> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span id="..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_311_757_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Class LocalizedItemList</span><span id="..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_311_757_Open_Text"><span style="color: #0000FF;">Class</span><span style="color: #000000;"> LocalizedItemList </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;">Private</span><span style="color: #000000;"> _culture </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> CultureInfo </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: #008080;">13</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Private</span><span style="color: #000000;"> _items </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">String</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: #008080;">15</span><span style="color: #000000;"><img id="..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_427_563_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_427_563_Open_Text').style.display='none'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_427_563_Closed_Image').style.display='inline'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_427_563_Closed_Text').style.display='inline';"/><img id="..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_427_563_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_427_563_Closed_Text').style.display='none'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_427_563_Open_Image').style.display='inline'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_427_563_Open_Text').style.display='inline';"/> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span id="..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_427_563_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub New()</span><span id="..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_427_563_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;">(</span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> culture </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> CultureInfo, </span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> items </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">String</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"/> _culture </span><span style="color: #000000;">=</span><span style="color: #000000;"> culture </span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> _items </span><span style="color: #000000;">=</span><span style="color: #000000;"> items </span><span style="color: #008080;">18</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> </span><span style="color: #0000FF;">End Sub</span></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: #008080;">20</span><span style="color: #000000;"><img id="..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_600_742_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_600_742_Open_Text').style.display='none'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_600_742_Closed_Image').style.display='inline'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_600_742_Closed_Text').style.display='inline';"/><img id="..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_600_742_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_600_742_Closed_Text').style.display='none'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_600_742_Open_Image').style.display='inline'; document.getElementById('..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_600_742_Open_Text').style.display='inline';"/> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Overloads</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Overrides</span><span style="color: #000000;"> </span><span id="..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_600_742_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Function ToString()</span><span id="..TranslatorsVB.ZipsLocalizedItemList.Vb_LocalizedItemList.Vb_633_51_600_742_Open_Text"><span style="color: #0000FF;">Function</span><span style="color: #000000;"> ToString() </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">String</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"/> </span><span style="color: #0000FF;">Return</span><span style="color: #000000;"> </span><span style="color: #0000FF;">String</span><span style="color: #000000;">.Join(</span><span style="color: #0000FF;">String</span><span style="color: #000000;">.Concat(_culture.TextInfo.ListSeparator, </span><span style="color: #800000;">"</span><span style="color: #800000;"> </span><span style="color: #800000;">"</span><span style="color: #000000;">), _items) </span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> </span><span style="color: #0000FF;">End Function</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"/> </span><span style="color: #008080;">24</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> </span><span style="color: #0000FF;">End Class</span></span><span style="color: #000000;"> </span><span style="color: #008080;">25</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/></span><span style="color: #0000FF;">End Namespace</span></span></div></pre></div></div> </p><p></span> <br></p><p>We'll be using this code to store and retrieve and instance of this class with different configuration<br>settings:</p><p><span name="cs_wiki_filter" csw_filters="cs"> </p><div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">TranslatorExample.cs: <span class="fscMemberName">TryStoreAndRetrieve</span></span></div><div class="fscCode"><pre ID="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_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;">public</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;"> TryStoreAndRetrieve(IConfiguration configuration) </span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_77_1302_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_77_1302_Open_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_77_1302_Closed_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_77_1302_Closed_Text').style.display='inline';"/><img id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_77_1302_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_77_1302_Closed_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_77_1302_Open_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_77_1302_Open_Text').style.display='inline';"/> </span><span id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_77_1302_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_77_1302_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"/> IObjectContainer db </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(configuration, Db4oFileName); </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 id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_192_541_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_192_541_Open_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_192_541_Closed_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_192_541_Closed_Text').style.display='inline';"/><img id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_192_541_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_192_541_Closed_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_192_541_Open_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_192_541_Open_Text').style.display='inline';"/> </span><span id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_192_541_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_192_541_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">06</span><span style="color: #000000;"><img id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_241_276_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_241_276_Open_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_241_276_Closed_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_241_276_Closed_Text').style.display='inline';"/><img id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_241_276_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_241_276_Closed_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_241_276_Open_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_241_276_Open_Text').style.display='inline';"/> </span><span style="color: #0000FF;">string</span><span style="color: #000000;">[] champs </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> </span><span style="color: #0000FF;">string</span><span style="color: #000000;">[] </span><span id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_241_276_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_241_276_Open_Text"><span style="color: #000000;">{ </span><span style="color: #800000;">"</span><span style="color: #800000;">Ayrton Senna</span><span style="color: #800000;">"</span><span style="color: #000000;">, </span><span style="color: #800000;">"</span><span style="color: #800000;">Nelson Piquet</span><span style="color: #800000;">"</span><span style="color: #000000;"> }</span></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"/> LocalizedItemList LocalizedItemList </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> LocalizedItemList(CultureInfo.CreateSpecificCulture(</span><span style="color: #800000;">"</span><span style="color: #800000;">pt-BR</span><span style="color: #800000;">"</span><span style="color: #000000;">), champs); </span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(</span><span style="color: #800000;">"</span><span style="color: #800000;">ORIGINAL: {0}</span><span style="color: #800000;">"</span><span style="color: #000000;">, LocalizedItemList); </span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> db.Set(LocalizedItemList); </span><span style="color: #008080;">10</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;">11</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">catch</span><span style="color: #000000;"> (Exception x) </span><span style="color: #008080;">12</span><span style="color: #000000;"><img id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_586_670_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_586_670_Open_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_586_670_Closed_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_586_670_Closed_Text').style.display='inline';"/><img id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_586_670_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_586_670_Closed_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_586_670_Open_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_586_670_Open_Text').style.display='inline';"/> </span><span id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_586_670_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_586_670_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"/> System.Console.WriteLine(x); </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;">return</span><span style="color: #000000;">; </span><span style="color: #008080;">15</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;">16</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;">17</span><span style="color: #000000;"><img id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_703_746_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_703_746_Open_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_703_746_Closed_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_703_746_Closed_Text').style.display='inline';"/><img id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_703_746_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_703_746_Closed_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_703_746_Open_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_703_746_Open_Text').style.display='inline';"/> </span><span id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_703_746_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_703_746_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"/> db.Close(); </span><span style="color: #008080;">19</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;">20</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> db </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(Db4oFileName); </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;">try</span><span style="color: #000000;"> </span><span style="color: #008080;">22</span><span style="color: #000000;"><img id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_828_1216_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_828_1216_Open_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_828_1216_Closed_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_828_1216_Closed_Text').style.display='inline';"/><img id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_828_1216_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_828_1216_Closed_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_828_1216_Open_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_828_1216_Open_Text').style.display='inline';"/> </span><span id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_828_1216_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_828_1216_Open_Text"><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"/> IObjectSet result </span><span style="color: #000000;">=</span><span style="color: #000000;"> db.Get(</span><span style="color: #0000FF;">typeof</span><span style="color: #000000;">(LocalizedItemList)); </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;">while</span><span style="color: #000000;"> (result.HasNext()) </span><span style="color: #008080;">25</span><span style="color: #000000;"><img id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_958_1202_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_958_1202_Open_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_958_1202_Closed_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_958_1202_Closed_Text').style.display='inline';"/><img id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_958_1202_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_958_1202_Closed_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_958_1202_Open_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_958_1202_Open_Text').style.display='inline';"/> </span><span id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_958_1202_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_958_1202_Open_Text"><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"/> LocalizedItemList LocalizedItemList </span><span style="color: #000000;">=</span><span style="color: #000000;"> (LocalizedItemList)result.Next(); </span><span style="color: #008080;">27</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(</span><span style="color: #800000;">"</span><span style="color: #800000;">RETRIEVED: {0}</span><span style="color: #800000;">"</span><span style="color: #000000;">, LocalizedItemList); </span><span style="color: #008080;">28</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> db.Delete(LocalizedItemList); </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="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_1249_1292_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_1249_1292_Open_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_1249_1292_Closed_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_1249_1292_Closed_Text').style.display='inline';"/><img id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_1249_1292_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_1249_1292_Closed_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_1249_1292_Open_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_1249_1292_Open_Text').style.display='inline';"/> </span><span id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_1249_1292_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreAndRetrieve_893_75_1249_1292_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/ExpandedBlockEnd.gif" align="top"/> }</span></span></div></pre></div></div><p></span> </p><p><span name="cs_wiki_filter" csw_filters="vb"> </p><div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">TranslatorExample.vb: <span class="fscMemberName">TryStoreAndRetrieve</span></span></div><div class="fscCode"><pre ID="..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreAndRetrieve_1046_75"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">01</span><img id="..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreAndRetrieve_1046_75_15_1213_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreAndRetrieve_1046_75_15_1213_Open_Text').style.display='none'; document.getElementById('..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreAndRetrieve_1046_75_15_1213_Closed_Image').style.display='inline'; document.getElementById('..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreAndRetrieve_1046_75_15_1213_Closed_Text').style.display='inline';"/><img id="..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreAndRetrieve_1046_75_15_1213_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreAndRetrieve_1046_75_15_1213_Closed_Text').style.display='none'; document.getElementById('..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreAndRetrieve_1046_75_15_1213_Open_Image').style.display='inline'; document.getElementById('..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreAndRetrieve_1046_75_15_1213_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="..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreAndRetrieve_1046_75_15_1213_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub TryStoreAndRetrieve()</span><span id="..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreAndRetrieve_1046_75_15_1213_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> TryStoreAndRetrieve(</span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> configuration </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IConfiguration) </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;"> 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(Db4oFileName) </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;">Try</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;"> champs </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">String</span><span style="color: #000000;">() </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> </span><span style="color: #0000FF;">String</span><span style="color: #000000;">() {</span><span style="color: #800000;">"</span><span style="color: #800000;">Ayrton Senna</span><span style="color: #800000;">"</span><span style="color: #000000;">, </span><span style="color: #800000;">"</span><span style="color: #800000;">Nelson Piquet</span><span style="color: #800000;">"</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;"> LocalizedItemList </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> LocalizedItemList </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> LocalizedItemList(CultureInfo.CreateSpecificCulture(</span><span style="color: #800000;">"</span><span style="color: #800000;">pt-BR</span><span style="color: #800000;">"</span><span style="color: #000000;">), champs) </span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(</span><span style="color: #800000;">"</span><span style="color: #800000;">ORIGINAL: {0}</span><span style="color: #800000;">"</span><span style="color: #000000;">, LocalizedItemList) </span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> db.Set(LocalizedItemList) </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;">Catch</span><span style="color: #000000;"> x </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Exception </span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(x) </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;">Return</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;">Finally</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"/> db.Close() </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;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Try</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"/> db </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(Db4oFileName) </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;">Try</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;">Dim</span><span style="color: #000000;"> result </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectSet </span><span style="color: #000000;">=</span><span style="color: #000000;"> db.Get(</span><span style="color: #0000FF;">GetType</span><span style="color: #000000;">(LocalizedItemList)) </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: #0000FF;">While</span><span style="color: #000000;"> result.HasNext() </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;">Dim</span><span style="color: #000000;"> LocalizedItemList </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> LocalizedItemList </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">DirectCast</span><span style="color: #000000;">(result.Next(), LocalizedItemList) </span><span style="color: #008080;">19</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(</span><span style="color: #800000;">"</span><span style="color: #800000;">RETRIEVED: {0}</span><span style="color: #800000;">"</span><span style="color: #000000;">, LocalizedItemList) </span><span style="color: #008080;">20</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> db.Delete(LocalizedItemList) </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;">While</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"/> </span><span style="color: #0000FF;">Finally</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.Close() </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;">Try</span><span style="color: #000000;"> </span><span style="color: #008080;">25</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><p></span> </p><a name="Using The Constructor "></a><h2>Using The Constructor </h2><p><span name="cs_wiki_filter" csw_filters="cs"> </p><div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">TranslatorExample.cs: <span class="fscMemberName">TryStoreWithCallConstructors</span></span></div><div class="fscCode"><pre ID="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreWithCallConstructors_1235_84"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">1</span><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/><span style="color: #0000FF;">public</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;"> TryStoreWithCallConstructors() </span><span style="color: #008080;">2</span><span style="color: #000000;"><img id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreWithCallConstructors_1235_84_58_348_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreWithCallConstructors_1235_84_58_348_Open_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreWithCallConstructors_1235_84_58_348_Closed_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreWithCallConstructors_1235_84_58_348_Closed_Text').style.display='inline';"/><img id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreWithCallConstructors_1235_84_58_348_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreWithCallConstructors_1235_84_58_348_Closed_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreWithCallConstructors_1235_84_58_348_Open_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreWithCallConstructors_1235_84_58_348_Open_Text').style.display='inline';"/> </span><span id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreWithCallConstructors_1235_84_58_348_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreWithCallConstructors_1235_84_58_348_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">3</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IConfiguration configuration </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.NewConfiguration(); </span><span style="color: #008080;">4</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> configuration.ExceptionsOnNotStorable(</span><span style="color: #0000FF;">true</span><span style="color: #000000;">); </span><span style="color: #008080;">5</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> configuration.ObjectClass(</span><span style="color: #0000FF;">typeof</span><span style="color: #000000;">(CultureInfo)) </span><span style="color: #008080;">6</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> .CallConstructor(</span><span style="color: #0000FF;">true</span><span style="color: #000000;">); </span><span style="color: #008080;">7</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> TryStoreAndRetrieve(configuration); </span><span style="color: #008080;">8</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/> }</span></span></div></pre></div></div><p></span> </p><p><span name="cs_wiki_filter" csw_filters="vb"> </p><div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">TranslatorExample.vb: <span class="fscMemberName">TryStoreWithCallConstructors</span></span></div><div class="fscCode"><pre ID="..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreWithCallConstructors_1397_84"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">1</span><img id="..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreWithCallConstructors_1397_84_15_331_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreWithCallConstructors_1397_84_15_331_Open_Text').style.display='none'; document.getElementById('..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreWithCallConstructors_1397_84_15_331_Closed_Image').style.display='inline'; document.getElementById('..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreWithCallConstructors_1397_84_15_331_Closed_Text').style.display='inline';"/><img id="..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreWithCallConstructors_1397_84_15_331_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreWithCallConstructors_1397_84_15_331_Closed_Text').style.display='none'; document.getElementById('..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreWithCallConstructors_1397_84_15_331_Open_Image').style.display='inline'; document.getElementById('..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreWithCallConstructors_1397_84_15_331_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="..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreWithCallConstructors_1397_84_15_331_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub TryStoreWithCallConstructors()</span><span id="..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreWithCallConstructors_1397_84_15_331_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> TryStoreWithCallConstructors() </span><span style="color: #008080;">2</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;"> configuration </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IConfiguration </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.NewConfiguration() </span><span style="color: #008080;">3</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> configuration.ExceptionsOnNotStorable(</span><span style="color: #0000FF;">True</span><span style="color: #000000;">) </span><span style="color: #008080;">4</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> configuration.ObjectClass(</span><span style="color: #0000FF;">GetType</span><span style="color: #000000;">(CultureInfo)).CallConstructor(</span><span style="color: #0000FF;">True</span><span style="color: #000000;">) </span><span style="color: #008080;">5</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> TryStoreAndRetrieve(configuration) </span><span style="color: #008080;">6</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><p></span> <br></p><p>At storage time, db4o tests the only available constructor with null arguments and runs into a<br>NullPointerException, so it refuses to accept our object.<br>(Note that this test only occurs when configured with <a href="../../object_lifecycle/object_construction/troubleshooting.html" class="wikiLink">exceptionsOnNotStorable</a> - otherwise db4o will<br>silently fail when trying to reinstantiate the object.) <br></p><a name="Bypassing The Constructor "></a><h2>Bypassing The Constructor </h2><p><span name="cs_wiki_filter" csw_filters="cs"> </p><div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">TranslatorExample.cs: <span class="fscMemberName">TryStoreWithoutCallConstructors</span></span></div><div class="fscCode"><pre ID="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreWithoutCallConstructors_1993_87"><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;">public</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;"> TryStoreWithoutCallConstructors() </span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreWithoutCallConstructors_1993_87_61_489_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreWithoutCallConstructors_1993_87_61_489_Open_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreWithoutCallConstructors_1993_87_61_489_Closed_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreWithoutCallConstructors_1993_87_61_489_Closed_Text').style.display='inline';"/><img id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreWithoutCallConstructors_1993_87_61_489_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreWithoutCallConstructors_1993_87_61_489_Closed_Text').style.display='none'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreWithoutCallConstructors_1993_87_61_489_Open_Image').style.display='inline'; document.getElementById('..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreWithoutCallConstructors_1993_87_61_489_Open_Text').style.display='inline';"/> </span><span id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreWithoutCallConstructors_1993_87_61_489_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="..TranslatorsCS.ZipsTranslatorExample.Cs_TranslatorExample.Cs_TryStoreWithoutCallConstructors_1993_87_61_489_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"/> IConfiguration configuration </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.NewConfiguration(); </span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> configuration.ObjectClass(</span><span style="color: #0000FF;">typeof</span><span style="color: #000000;">(CultureInfo)) </span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> .CallConstructor(</span><span style="color: #0000FF;">false</span><span style="color: #000000;">); </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: #008000;">//</span><span style="color: #008000;"> trying to store objects that hold onto </span><span style="color: #008080;">07</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;"> system resources can be pretty nasty </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: #008000;">//</span><span style="color: #008000;"> uncomment the following line to see </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: #008000;">//</span><span style="color: #008000;"> how nasty it can be </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: #008000;">//</span><span style="color: #008000;">TryStoreAndRetrieve(configuration);</span><span style="color: #008000;"> </span><span style="color: #008080;">11</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/></span><span style="color: #000000;"> }</span></span></div></pre></div></div><p></span> </p><p><span name="cs_wiki_filter" csw_filters="vb"> </p><div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">TranslatorExample.vb: <span class="fscMemberName">TryStoreWithoutCallConstructors</span></span></div><div class="fscCode"><pre ID="..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreWithoutCallConstructors_2158_87"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">1</span><img id="..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreWithoutCallConstructors_2158_87_15_469_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreWithoutCallConstructors_2158_87_15_469_Open_Text').style.display='none'; document.getElementById('..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreWithoutCallConstructors_2158_87_15_469_Closed_Image').style.display='inline'; document.getElementById('..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreWithoutCallConstructors_2158_87_15_469_Closed_Text').style.display='inline';"/><img id="..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreWithoutCallConstructors_2158_87_15_469_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreWithoutCallConstructors_2158_87_15_469_Closed_Text').style.display='none'; document.getElementById('..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreWithoutCallConstructors_2158_87_15_469_Open_Image').style.display='inline'; document.getElementById('..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreWithoutCallConstructors_2158_87_15_469_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="..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreWithoutCallConstructors_2158_87_15_469_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub TryStoreWithoutCallConstructors()</span><span id="..TranslatorsVB.ZipsTranslatorExample.Vb_TranslatorExample.Vb_TryStoreWithoutCallConstructors_2158_87_15_469_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> TryStoreWithoutCallConstructors() </span><span style="color: #008080;">2</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;"> configuration </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IConfiguration </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.NewConfiguration() </span><span style="color: #008080;">3</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> configuration.ObjectClass(</span><span style="color: #0000FF;">GetType</span><span style="color: #000000;">(CultureInfo)).CallConstructor(</span><span style="color: #0000FF;">False</span><span style="color: #000000;">) </span><span style="color: #008080;">4</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;"> trying to store objects that hold onto</span><span style="color: #008000;"> </span><span style="color: #008080;">5</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;"> system resources can be pretty nasty</span><span style="color: #008000;"> </span><span style="color: #008080;">6</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;"> uncomment the following line to see</span><span style="color: #008000;"> </span><span style="color: #008080;">7</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;"> how nasty it can be</span><span style="color: #008000;"> </span><span style="color: #008080;">8</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;">TryStoreAndRetrieve(configuration);</span><span style="color: #008000;"> </span><span style="color: #008080;">9</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/></span><span style="color: #000000;"> </span><span style="color: #0000FF;">End Sub</span></span></div></pre></div></div><p></span> <br></p><p>This still does not work for our case because the native pointer will definitely be invalid. In fact this<br>example crashes the Common Language Runtime. <br></p><p>In order to solve the problem we will need to use <a href="the_translator_api.html" class="wikiLink">db4o Translators</a>. </p></div> </div> <div id="footer"> This revision (3) was last Modified 2007-08-04T20:14:33 by Tetyana. </div> </body> </html>