> Would example 1 leave resources undisposed of? I'm assuming the answer is
> yes and that example 2 would be the way to go but it would be good to get
> confirmation.
>
Yes,
Additionally, you may want to write:
string productNameList = String.Empty;
for(int i = 0; i < productIdList.Length; i++)
{
using ( Product p = ProductCatalog.GetProduct(productIdList[i].ToString()))
{
productNameList += p.Name + ",";
}
}
HTH
// Ryan
===================================
This list is hosted by DevelopMentor� http://www.develop.com
Some .NET courses you may be interested in:
Essential .NET: building applications and components with CSharp
August 30 - September 3, in Los Angeles
http://www.develop.com/courses/edotnet
View archives and manage your subscription(s) at http://discuss.develop.com