On 6/28/07, Andrew Welch <andrew.j.welch@gmail.com> wrote:
On 6/28/07, Simon Shutter <simon@schemax.com> wrote:
> When I run the following code the xsl file is not released.  Am I doing
> something wrong?

> DomDestination result = new DomDestination(); transformer.Run(result);

> result = null;

call result.close() first?

object = null; is a VB-ism that doesn't translate well to C#.  As Andrew points out, us object.Close(), or better yet, enclose your operation in the using keyword  (e.g. using(object){ ... }) which, for any object that implements the IDisposable interface, will automagically clean things up for you.

Also, result.close won't free up the transformation file, only the result stream.  Use transformer.Close() or wrap it in a using block.

--
/M:D

M. David Peterson
http://mdavid.name | http://www.oreillynet.com/pub/au/2354 | http://dev.aol.com/blog/3155