I've been coding with 'using' blocks but I am wondering if I can return an IQueryable from the following without the object being disposed before I access it.
public IQueryable<Contact> GetContacts(string clientID)
{
using (dbDataContext db = new dbDataContext())
{
var contacts = from _contacts in db.Contacts
where _contacts.ClientID == clientID
orderby _contacts.LastName ascending
select _contacts;
return contacts;
}
}
Do I simply remove the 'using' block and let .Net manage the objects, or can I get Linq to run the query early and return the populated object.