type used in a using statement must be implicitly convertible to 'System.IDisposable'

by Tom Hundley 20. May 2010 11:37

If you are using “using” statements to manage your data contexts in Linq to SQL (I’m not sure if this applies to Linq to Entity but I imagine it does") and you get the following error: “type used in a using statement must be implicitly convertible to 'System.IDisposable'”, simply add a reference to the “System.Data.Linq” assembly and it solves the problem.

image

 

Happy coding,

Tom Hundley
Elegant Software Solutions, LLC

Tags: , ,

C# | Linq

Comments (3) -

Peter Harris
3/2/2012 4:31:07 AM #

Thank you.  Neat, concise, and to the point.
Helped me deal with a truly oddball error message.

Reply

Nima
4/9/2012 4:12:44 AM #

very useful, thanks

Reply

Zack
4/18/2012 6:58:51 PM #

I tried this and it didnt work. I then added (duh) a reference to System.Data.Entity and it fixed it. I was moving code from one project to another.

Reply

Add comment

biuquote
  • Comment
  • Preview
Loading