below my code is very slow and has been reported to occasionally throw an exception. wants to know will use of dictionary or ienumerable make any difference?
// Will find the address of the company with the given name.
public string FindAddress(List<Company> companyList, string name)
{
foreach (Company company in companyList)
{
if (name.Trim().ToUpper() == company.Name.ToUpper())
return company.Address;
}
return null;
}