March 2009 Entries

Searching for an item in a list

It's cool to see how the .Net framework has evolved from 1.1 to 2.0 and to 3.5. Searching for items in a list is a pretty common programming task. This is a comparison of how list searching has changed throughout the different .Net framework versions. //.Net 1.1 search using a foreach statement foreach (Customer cust in customerList) { if (cust.FirstName == "Bill") { customer = cust; break; } } //.Net 2.0 search using a inline delegate Customer cust = customers.Find( delegate(Customer c) { return...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Refresh AppSettings keys

The .Net runtime caches the app.config file, therefore, when the app.config file is updated, you often need to restart the application in order for the changes to show up. Sure, you can get the keys by calling ConfigurationManager.OpenEx... and you would be getting the latest version of the config file every time, but it's probably not the most efficient way to do it. Here is how I like to do it. I call ConfigurationManager.AppSet... to get my key, which gets the cached...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

«March»
SunMonTueWedThuFriSat
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234