Re: can't write to newly created file - file being used by another process

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hmm, I thought XmlTextWriter derived from TextWriter (odd that it
doesn't). Oh well, we were both right, I was referring to 2.0.


--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx

"Jon Skeet [C# MVP]" <skeet@xxxxxxxxx> wrote in message
news:MPG.1dc0bd5b95f2bd8898c960@xxxxxxxxxxxxxxxxxxxxxxx
> Nicholas Paldino [.NET/C# MVP] <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>> XmlTextWriter does implement IDisposable. Jon was being sarcastic.
>
> No, I wasn't, and it doesn't - in 1.1. Try it:
>
> using System;
> using System.Xml;
> using System.Text;
>
> public class Test
> {
> static void Main()
> {
> using (XmlTextWriter x = new XmlTextWriter("test.xml",
> Encoding.UTF8))
> {
> }
> }
> }
>
> gives the error:
>
> Test.cs(9,9): error CS0029: Cannot implicitly convert type
> 'System.Xml.XmlTextWriter' to 'System.IDisposable'
>
> It works fine for 2.0, but I suspect most people aren't using that
> yet...
>
> --
> Jon Skeet - <skeet@xxxxxxxxx>
> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
> If replying to the group, please do not mail me too


.



Relevant Pages

  • Re: Sorry-
    ... >urination or defection by dogs or cats, says that "the dog went ... If I may speak for Americans generally, no, we don't. ... how about people referring to "the ground" (that ... "I feel on the floor" would sound very odd to me if the speaker were ...
    (soc.motss)
  • Re: Race in new page migration code?
    ... > Hmm, that battery of unusual tests at the start of migrate_page_add ... > is odd: the tests don't quite match the comment, ...
    (Linux-Kernel)
  • Re: Strikes me as odd that .... Bush Crime Family cabal on soc.retirement
    ... Strikes me as odd that... ... hmm that would be a good two hours of ... neo-cons ending the anti-monopolization laws for various media not to ...
    (soc.retirement)
  • Re: Karajans 60s Beethoven
    ... possible that Higgs is referring to different performances altogether (It's odd ... that he doesn't mention one of the stranger features of the 9th, ...
    (rec.music.classical.recordings)
  • Re: Sorry-
    ... >>urination or defection by dogs or cats, ... > If I may speak for Americans generally, no, we don't. ... Well, as a Midwesterner, it wouldn't sound odd to me. ... how about people referring to "the ...
    (soc.motss)