I have a CustomerRepository class (in my BL), and I am returning a collection as follows:
public static ICollection<Customer> FindCustomers()
{
Collection<Customer> customers = null;
try
{
customers = DAL.GetCustomers();
}
catch (Exception ex)
{
//log and re-throw exception here
}
return customers;
}
I have a few questions on this:
- Is the try/catch block ok?
- I am creating the collection outside try, and returning it outside catch.
Am I overlooking any best practices here?
Would love to know about potential gotchas here :)