May 16, 2005

System.Xml 2.0: XmlReader is now IDisposabe

Another handy feature implemented in .NET 2.0 Beta2 is that XmlReader class now implements IDisposable interface and so can be closed automatically when using with "using" statement in C#: using (XmlReader r = XmlReader.Create("../../source.xml")) { while (r.Read()) Console.WriteLine(r.NodeType); } Really handy. And implemented in literally couple of lines. It's a ...