<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>My occasionally useful ramblings...</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/chrisbarker/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/chrisbarker/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:39:44 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Consuming a C++ library project from a Windows Phone Store app</title>
      <link>https://docs.microsoft.com/archive/blogs/chrisbarker/consuming-a-c-library-project-from-a-windows-phone-store-app</link>
      <pubDate>Wed, 08 Oct 2014 04:44:06 GMT</pubDate>
      <dc:creator><![CDATA[Chris Barker (Personal)]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/chrisbarker/2014/10/08/consuming-a-c-library-project-from-a-windows-phone-store-app/</guid>
      <description><![CDATA[This article will step you through consuming a C++ library project from a Windows Phone Store app...]]></description>
      <content:encoded><![CDATA[<p><i>This article will step you through consuming a C++ library project from a Windows Phone Store app via a separate intermediary WinRT component. These steps can equally be applied to a Windows Store app and therefore a solution that utilises the Universal App template. A Windows Phone app built on Silverlight is not covered in this article.&#160; </i><i>Thanks to <a href="https://twitter.com/vladkol">Vladimir Kolesnikov</a> for helping pull this together.</i></p>  <p>When building a Windows Phone Store app, there are occasions when you wish to consume logic within a library that you have previously written in C++. In order to consume this logic in a Windows Phone Store app you need to wrap that C++ logic using a WinRT component. The WinRT component acts as a wrapper around the C++ code and is a means of projecting the correct types across the Abstract Binary Interface (such that it may be consumed in languages other than C++). There is documentation and sample code demonstrating how to achieve this, but they tend to show the C++ logic inside of the WinRT component. In the real-world, you will likely have the C++ code in a separate project and therefore you need to reference this from the WinRT component. This scenario is not well documented and so it is the objective of this article to walk through how you can go about setting this up.</p>  <p>Before getting started, the diagram in Figure 1 shows the projects that are, or will be involved.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/90/metablogapi/4812.Figure-1_035C2EA6.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-32-90-metablogapi/4812.Figure_2D00_1_5F00_035C2EA6.png"><img title="Figure 1" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Figure 1" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/90/metablogapi/5504.Figure-1_thumb_0122369B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-32-90-metablogapi/5504.Figure_2D00_1_5F00_thumb_5F00_0122369B.png" width="640" height="77" /></a></p>  <p>Figure 1 - High-level solution structure</p>  <p>First of all, on the left you have the “DemoApp.WindowsPhone” project, which contains the application’s user interface. On the right you have the “DemoWin32Project”, which contains the C++ logic that you wish to call. In this example, the project is assumed to be a Win32 DLL project type. The grey box in the middle of the diagram represents the C++ WinRT component that wraps the calls to the Win32 DLL project. This article assumes that you already have the components in blue already at your disposal, whilst the component in grey needs to be created.</p>  <p>So, the first step is going to be to create the C++ WinRT component. You can do this by adding a new project to the solution and selecting the appropriate project type as demonstrated in Figure 2. For the purposes of this example, the project type will be “Windows Runtime Component (Windows Phone) – Visual C++” (highlighted in green) as the application calling it is a Windows Phone Store app. If this was a Windows Store app or a Universal app, then you would instead need to select the appropriate project type shown in amber.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/90/metablogapi/1738.Figure-2_3C096964.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-32-90-metablogapi/1738.Figure_2D00_2_5F00_3C096964.png"><img title="Figure 2" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Figure 2" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/90/metablogapi/4010.Figure-2_thumb_2B90F869.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-32-90-metablogapi/4010.Figure_2D00_2_5F00_thumb_5F00_2B90F869.png" width="640" height="403" /></a></p>  <p>Figure 2 - Creating the Windows Runtime Component</p>  <p>Once you have created the component, you can add a project reference to it from the application project (in this case “DemoApp.WindowsPhone”). This is shown in Figure 3.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/90/metablogapi/6404.Figure-3_01B08434.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-32-90-metablogapi/6404.Figure_2D00_3_5F00_01B08434.png"><img title="Figure 3" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Figure 3" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/90/metablogapi/7485.Figure-3_thumb_11BF52EB.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-32-90-metablogapi/7485.Figure_2D00_3_5F00_thumb_5F00_11BF52EB.png" width="640" height="115" /></a></p>  <p>Figure 3 - Adding the project reference to the Windows Runtime Component</p>  <p>As the application project is going to be referencing C++ code, it is also important to add a reference to the Visual C++ runtime as shown in Figure 4.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/90/metablogapi/0412.Figure-4_2161EEAD.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-32-90-metablogapi/0412.Figure_2D00_4_5F00_2161EEAD.png"><img title="Figure 4" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Figure 4" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/90/metablogapi/1031.Figure-4_thumb_0A36742F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-32-90-metablogapi/1031.Figure_2D00_4_5F00_thumb_5F00_0A36742F.png" width="640" height="239" /></a></p>  <p>Figure 4 - Add reference to Visual C++ runtime</p>  <p>The actual code logic that sits inside of these projects will not be discussed here as they are largely irrelevant.</p>  <p>At this point, you will want to add a reference from the Windows Runtime Component to the Win32 DLL project. It is this step that is not so well documented. Unfortunately there is a little bit of extra work to do here to get this working, although it is extremely straightforward once you know how.</p>  <p>Figure 1 implies that the C++ component is a Win32 Project type. This is intentional as it is likely the project type your existing code sits inside of – however, in order to be able to reference this logic, the code needs to sit inside of a subtly different project type. The next step is to create that other project type, which in this example will be “DLL (Windows Phone) – Visual C++” – highlighted in green in Figure 5. If this was a Windows Store app or a Universal app, then you would instead need to select the appropriate project type shown in amber.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/90/metablogapi/1464.Figure-5_3C30A56A.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-32-90-metablogapi/1464.Figure_2D00_5_5F00_3C30A56A.png"><img title="Figure 5" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Figure 5" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/90/metablogapi/3058.Figure-5_thumb_36E1BEB9.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-32-90-metablogapi/3058.Figure_2D00_5_5F00_thumb_5F00_36E1BEB9.png" width="640" height="399" /></a></p>  <p>Figure 5 - Creating the appropriate DLL project type</p>  <p>Once this is done, you need to either move across the C++ source files from your Win32 DLL project, or add a link to their existing location – either way, this entails just a few manual steps depending on how many source files you have. Finally, you will need to make sure you are referencing the appropriate header files in the DLL project from the Windows Runtime Component project so that you can code against the DLL. Figure 6 shows the configuration that needs to be applied in green.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/90/metablogapi/1348.Figure-6_142086FC.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-32-90-metablogapi/1348.Figure_2D00_6_5F00_142086FC.png"><img title="Figure 6" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Figure 6" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/90/metablogapi/1768.Figure-6_thumb_6AAC45BB.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-32-90-metablogapi/1768.Figure_2D00_6_5F00_thumb_5F00_6AAC45BB.png" width="640" height="82" /></a></p>  <p>Figure 6 - Add 'Include Directories' to point to appropriate .h files</p>  <p>Now that these steps have been completed, you are in good shape for referencing the DLL project from the Windows Runtime Component project. Simply, go to the project properties of the Windows Runtime Component and navigate to “Common Properties” -&gt; “References”. In this dialog you can point to the project created in Figure 5 as demonstrated in Figure 7.</p>  <p>It is worth pointing out that you can’t simply reference any and every Win32 DLL project as there is only a subset of Win32 APIs that are supported inside of a Windows Runtime project.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/90/metablogapi/2476.Figure-7_6C7C9B82.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-32-90-metablogapi/2476.Figure_2D00_7_5F00_6C7C9B82.png"><img title="Figure 7" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Figure 7" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/90/metablogapi/1323.Figure-7_thumb_7C8B6A39.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-32-90-metablogapi/1323.Figure_2D00_7_5F00_thumb_5F00_7C8B6A39.png" width="640" height="108" /></a></p>  <p>Figure 7 - Add a reference to the newly created DLL project type</p>  <p>At this point, you have created the chain shown in Figure 1 – in other words, the application code on the left-hand side of the diagram may now call into the C++ logic held by the DLL project type by means of the Windows Runtime Component.</p>  <p>These steps may be followed for either a Universal App template or a Windows Store app as appropriate. Furthermore, Visual Studio allows you to right-click each the projects represented by the first two boxes in Figure 1 and select “Add Windows 8.1” to automatically create the Universal App project structure. This can also be performed on the project created in Figure 5, which essentially gives the solution structure represented in Figure 8.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/90/metablogapi/6064.Figure-8_3E25A686.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-32-90-metablogapi/6064.Figure_2D00_8_5F00_3E25A686.png"><img title="Figure 8" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Figure 8" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/90/metablogapi/6406.Figure-8_thumb_3BEBAE7B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-32-90-metablogapi/6406.Figure_2D00_8_5F00_thumb_5F00_3BEBAE7B.png" width="640" height="241" /></a></p>  <p>Figure 8 - Universal App calling a C++ library</p>  <p>The only steps that remain is to update the reference to point to the correct platform implementation as illustrated by the arrows in the diagram.</p>  <p>For a working version of the solution outlined in Figure 1, please see the attached solution.</p>  <div id="scid:8eb9d37f-1541-4f29-b6f4-1eea890d4876:1a2c0084-189e-44b8-b25b-f47b47a90382" class="wlWriterEditableSmartContent" style="float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px"><p><div><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/90/metablogapi/8105.Consuming-a-C-library-from-a-Windows-Phone-Store-app_2892D1A4.zip" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-32-90-metablogapi/8105.Consuming_2D00_a_2D00_C_2D00_library_2D00_from_2D00_a_2D00_Windows_2D00_Phone_2D00_Store_2D00_app_5F00_2892D1A4.zip" target="_self">Consuming a C++ library from a Windows Phone Store app.zip</a></div></p></div>]]></content:encoded>
    </item>
    <item>
      <title>WPF: Choosing the most appropriate collection for your data</title>
      <link>https://docs.microsoft.com/archive/blogs/chrisbarker/wpf-choosing-the-most-appropriate-collection-for-your-data</link>
      <pubDate>Thu, 04 Mar 2010 06:16:00 GMT</pubDate>
      <dc:creator><![CDATA[cbarker]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/chrisbarker/2010/03/04/wpf-choosing-the-most-appropriate-collection-for-your-data/</guid>
      <description><![CDATA[A few months ago now, I was working with a customer where we were trying to performance tune their...]]></description>
      <content:encoded><![CDATA[<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT face=Calibri><FONT size=3>A few months ago now, I was working with a customer where we were trying to performance tune their WPF 3.x application.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>One of the larger bottlenecks we found in the application was around the way lists of data were being held.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>It took much poking around and profiling of the application before we realised that we could improve the performance by replacing unnecessary ObservableCollections with Lists.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT face=Calibri><FONT size=3>In this post I am going to attempt to show some of the variations in performance you will get when using an ObservableCollection&lt;T&gt; versus a List&lt;T&gt;.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>The tests I have done are by no means scientific, but they should hopefully highlight the need to consider this area in more detail when developing your application, or revisiting performance in retrospect.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT face=Calibri><FONT size=3>I have put together a very simple test application which you can download at the end of this article.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>The application tackles the following three scenarios:<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo2" class=MsoListParagraphCxSpFirst><SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri><FONT size=3>Adding and modifying items in a List.<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo2" class=MsoListParagraphCxSpMiddle><SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri><FONT size=3>Adding and modifying items in an ObservableCollection<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 10pt 36pt; mso-list: l0 level1 lfo2" class=MsoListParagraphCxSpLast><SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3><FONT face=Calibri>Adding and modifying items in an ObservableCollection that is bound to a ListBox in the UI.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri>The number of items to be added in each case is an arbitrary 100,000 Customer items, where the Customer type looks something like this:<o:p></o:p></FONT></FONT></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">class</SPAN> <SPAN style="COLOR: #2b91af">Customer</SPAN> : <SPAN style="COLOR: #2b91af">INotifyPropertyChanged<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">private</SPAN> <SPAN style="COLOR: blue">string</SPAN> name;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">string</SPAN> Name<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">get</SPAN> { <SPAN style="COLOR: blue">return</SPAN> name; }<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">set<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>name = <SPAN style="COLOR: blue">value</SPAN>;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>OnPropertyChanged(<SPAN style="COLOR: #a31515">"Name"</SPAN>);<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">private</SPAN> <SPAN style="COLOR: blue">int</SPAN> age;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">int</SPAN> Age<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">get</SPAN> { <SPAN style="COLOR: blue">return</SPAN> age; }<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">set<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>age = <SPAN style="COLOR: blue">value</SPAN>;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>OnPropertyChanged(<SPAN style="COLOR: #a31515">"Age"</SPAN>);<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">private</SPAN> <SPAN style="COLOR: #2b91af">Address</SPAN> officeLocation;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: #2b91af">Address</SPAN> OfficeLocation<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">get</SPAN> { <SPAN style="COLOR: blue">return</SPAN> officeLocation; }<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">set<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>officeLocation = <SPAN style="COLOR: blue">value</SPAN>;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>OnPropertyChanged(<SPAN style="COLOR: #a31515">"OfficeLocation"</SPAN>);<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><FONT face=Calibri><FONT size=3><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN></FONT></SPAN><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">// Remaining code removed for brevity<o:p></o:p></SPAN></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri>Below you can see a table where the timing information is given for each scenario when adding 100,000 records:<o:p></o:p></FONT></FONT></P>
<TABLE style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; BORDER-COLLAPSE: collapse; BORDER-TOP: medium none; BORDER-RIGHT: medium none; mso-border-alt: solid windowtext .5pt; mso-yfti-tbllook: 1184; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt" class=MsoTableGrid border=1 cellSpacing=0 cellPadding=0 class="MsoTableGrid">
<TBODY>
<TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes">
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; PADDING-BOTTOM: 0cm; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 163.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt" vAlign=top width=218>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt" class=MsoNormal><B style="mso-bidi-font-weight: normal"><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></B></P></TD>
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0cm; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 167.85pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" vAlign=top width=224>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt" class=MsoNormal><B style="mso-bidi-font-weight: normal"><FONT size=3><FONT face=Calibri>Time (ms) adding 100,000 records<o:p></o:p></FONT></FONT></B></P></TD>
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0cm; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 130.65pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" vAlign=top width=174>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt" class=MsoNormal><B style="mso-bidi-font-weight: normal"><FONT size=3><FONT face=Calibri>Bound to a UI element?<o:p></o:p></FONT></FONT></B></P></TD></TR>
<TR style="mso-yfti-irow: 1">
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; PADDING-BOTTOM: 0cm; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 163.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=218>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri>List&lt;Customer&gt;<o:p></o:p></FONT></FONT></P></TD>
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0cm; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 167.85pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=224>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri>~ 29<o:p></o:p></FONT></FONT></P></TD>
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0cm; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 130.65pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=174>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri>No<o:p></o:p></FONT></FONT></P></TD></TR>
<TR style="mso-yfti-irow: 2">
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; PADDING-BOTTOM: 0cm; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 163.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=218>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri>ObservableCollection&lt;Customer&gt;<o:p></o:p></FONT></FONT></P></TD>
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0cm; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 167.85pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=224>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri>~ 109<o:p></o:p></FONT></FONT></P></TD>
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0cm; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 130.65pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=174>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri>No<o:p></o:p></FONT></FONT></P></TD></TR>
<TR style="mso-yfti-irow: 3; mso-yfti-lastrow: yes">
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; PADDING-BOTTOM: 0cm; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 163.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=218>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri>ObservableCollection&lt;Customer&gt;<o:p></o:p></FONT></FONT></P></TD>
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0cm; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 167.85pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=224>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri>~ 1334<o:p></o:p></FONT></FONT></P></TD>
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0cm; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 130.65pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=174>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri>Yes<o:p></o:p></FONT></FONT></P></TD></TR></TBODY></TABLE>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri>It may not be of great surprise to see that when bound to the UI the performance is several times slower than when it is not.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Slightly more surprising though is that the ObservableCollection is a number of times slower than a List when there is no UI involved.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN><o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri>It is true to say that these numbers are all pretty small, and the variations could be considered negligible.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Whilst this will be true for many simple forms-based applications that are binding to a small set of properties, it does become of greater concern when you are binding to large numbers of properties that perhaps contain hierarchical information.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Furthermore, if you have lots of controls binding to the model, and that data frequently changes, you may also run into this bottleneck.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri>In the simple test application attached, you will find that despite changing properties frequently, the performance isn’t duly impacted and memory/CPU pressures remain low.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>In the real-world application however, we were hitting the performance bottlenecks.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>This really does emphasise that in many cases you may not encounter a problem, but if you do have a more complex scenario, you should consider the points in the following conclusion.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><B style="mso-bidi-font-weight: normal"><FONT size=3><FONT face=Calibri>Conclusion<o:p></o:p></FONT></FONT></B></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri>You can optimise the performance of your collections in a number of ways:<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpFirst><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>1.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3><FONT face=Calibri>Ideally only use an ObservableCollection&lt;T&gt; if you need to expose change notifications to the UI.<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>2.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3><FONT face=Calibri>If you need to work off the same set of data, and only need to update the UI some of the time, consider the following:<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 72pt; mso-add-space: auto; mso-list: l1 level2 lfo1" class=MsoListParagraphCxSpMiddle><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>a.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3><FONT face=Calibri>Work with a List&lt;T&gt; when performing your initial data operations, and convert to an ObservableCollection&lt;T&gt; when you are ready to expose your data to the UI.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>This approach won’t be suitable for most cases as it does not offer a lot of flexibility after the initial data has been populated.<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 72pt; mso-add-space: auto; mso-list: l1 level2 lfo1" class=MsoListParagraphCxSpMiddle><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>b.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri><FONT size=3>In your Property Setters, figure out whether you need to update the UI for a particular update.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>If you don’t, then consider whether or not you need to fire the PropertyChanged event.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>For example, you might have some code that looks like this: <o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0cm 0cm 0pt 72pt; mso-add-space: auto" class=MsoListParagraphCxSpMiddle><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><SPAN style="COLOR: black">if (UI_MODE</SPAN><SPAN style="COLOR: #1f497d">) <o:p></o:p></SPAN></FONT></SPAN></P>
<P style="TEXT-INDENT: 36pt; MARGIN: 0cm 0cm 10pt 72pt; mso-add-space: auto" class=MsoListParagraphCxSpLast><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">OnPropertyChanged(<SPAN style="COLOR: #a31515">"Age"</SPAN>);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Where UI_MODE can be toggled depending on how the data is being consumed.<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 10pt 72pt; mso-add-space: auto; mso-list: l1 level2 lfo1" class=MsoListParagraph><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>c.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3 face=Calibri>When adding or removing items from an ObservableCollection&lt;T&gt;, a CollectionChanged event will fire for each item.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>This can have quite a performance impact and you may want to batch up UI notifications.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Whereas you can code around this, there is a new type in .NET 4.0 that will support batching and therefore improve performance in many scenarios.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>See BulkObservableCollection&lt;T&gt; (</FONT><A href="https://msdn.microsoft.com/en-us/library/dd867973(VS.100).aspx)"><FONT color=#0000ff size=3 face=Calibri>https://msdn.microsoft.com/en-us/library/dd867973(VS.100).aspx)</FONT></A><FONT size=3><FONT face=Calibri> for further details.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri>As we were dealing with .NET 3.x, and because we wanted more fine grained control over when the events would fire, the solution of choice for the real-world application was 2b.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri>If you have hit any problems in this area and have a more readily reproducible sample of the behaviour, it would be great to hear from you.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/09/97/28/13/WPF%20Performance.zip" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-09-97-28-13/WPF-Performance.zip">WPF Performance.zip</a></p>]]></content:encoded>
    </item>
  </channel>
</rss>