Geeks With Blogs
HanSolo code monkey 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 ......

Posted On Saturday, March 21, 2009 6:30 PM

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 ......

Posted On Saturday, March 7, 2009 5:11 PM

Copyright © HanSolo | Powered by: