From: Arne Vajhøj on 17 Jan 2010 16:06
On 17-01-2010 11:31, Family Tree Mike wrote:
> On 1/17/2010 9:40 AM, AMP wrote:
>> I have:
>> writer = XmlWriter.Create("mike.xml",settings);
>> // ......Do Some stuff. This works writes an xml file.
>> // Then I try to close it
>> //But I get an error saying I cant open it, its being used
>> FileStream fs = new FileStream("mike.xml", FileMode.Open);
>> ....More stuff
>> What am I missing?
> using (XmlWriter writer = XmlWriter.Create("mike.xml", settings))
> // do stuff...
> using (FileStream fs = new FileStream("mike.xml", FileMode.Open))
The important point being that using will ensure that Dispose
actually gets called.
There should not be functional differences between Close and
First | Prev |
Pages: 1 2
Prev: WinForm - Color difference between windows XP and Windows 7
Next: RDA (remote data access)