As for encoder performance, what is the fastest way in VS 2005 or 2008 to determine if Foo IDisposable implements. It happened to me more than once that I was caught using a type without a block using, because it never occurred to me that a thing would have to implement IDisposable.
using
Put it in a using statement and see if it compiles:
using (var x = new TypeInQuestion(params)) {}
This will not compile unless TypeInQuestionit implements IDisposable.
TypeInQuestion
- ReSharper, (x ) , using.
x
ReSharper, , Alt + Enter. : "Wrap with 'using", IDisposable.
, .
F12 , F12 , , - IDisposable, .
IO, / , , Dispose.
, "Close" , , , XmlReader ( IDisposable), Dispose, .
- , , ( ) , , IDisposable. . , .
IDE, , - IDisposible, . IDE , , .
PowerShell, .
[System.Management.Automation.Runspaces.pipeline].getinterface("IDisposable")
IsPublic IsSerial Name BaseType -------- -------- ---- -------- True False IDisposable
[datetime].getinterface("IDisposable")
.
ReSharper, Visual Studio, , , stringWriter :
TextWriter writer = new StringWriter(); writer.WriteLine("Test");
"" "" "", :
using (TextWriter writer = new StringWriter()) { writer.WriteLine("Test"); }
" ..." , IDisposable.
, intellisense .Dispose
( , () )
, FXCop, , IDisposable arent using().
# , , , , ".Dispose()", , , IDisposable. , intellisence Dispose(), () ... !