[Mono-dev] TextReader, TextWriter and IDisposable

Leszek Ciesielski skolima at gmail.com
Sat Oct 21 11:14:36 EDT 2006


Hi,

when I tested my vs2005 projects against xbuild, I found an annoying
bug. My 2.0 code did not  compile. I attach a snippet, alongs with
comments. It seems that 1.0 TextReader/Writer did not implement
IDisposable (or implemented it explicitly), although I cannot find
this info on msdn (there is only a note that their Dispose() methods
are new in 2.0). However, as I compiled with gmcs, the error still
arose:

error CS0122: `System.IO.TextReader.Dispose(bool)' is inaccessible due
to its protection level

this time only with TextReader.

First: it's a glitch in TextReader (it implements the interface
explicitly, so the object is only disposable when cast to
IDisposable), it's Dispose() implementation should be changed to this
of TextWriter, this is also visible on class status pages.

Second: isn't this also a small problem with the compiler? Why does it
complain about Dispose(bool), when I only reference Dispose() in my
code?

-- 
MS-DOS user since 5.0
Windows user since 3.11
Linux user since kernel 2.4
Novell Netware user since 2.2
WARCRAFT user since 1.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Program.cs
Type: application/octet-stream
Size: 660 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20061021/fc69b3e4/attachment.obj 


More information about the Mono-devel-list mailing list