Plunging into .NET Development

Weblog Pieter Gheysens
Microsoft .NET Development - C# - Enterprise Library - Visual Studio 2005 Team System - Compuware DevPartner - ...
 


Friday, February 17

List of countries from registry + Databinding

Did you know that all known countries are listed in the registry [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Telephony\Country List\]? Here's how to look them up in C# and how to show them alphabetically in a combobox ...



Another thing that shocked me by surprise : the order for databinding is important! Look at my first implementation of the databinding.



Coincidentally I was running a profiling tool (Compuware DevPartner Studio) and saw - after executing the previous code - that the line with DisplayMember took almost the same time to complete as the DataSource-line. After digging into it a little deeper with DevPartner I noticed that binding actually occurred on both lines! So I tried to reorder my binding code to find out how to overcome ...



Result : databinding happens only once and it takes a lot less time to complete. I can imagine that this issue can take away a lot of processing time (percentage) if you have a lot of data to bind. You also won't notice it at first sight because you will think that's the right penalty to pay for your databinding. Watch out for it!

0 Comments:

Post a Comment

<< Home