How is it that the abstract class XmlWriter can be instantiated using XmlWriter.Create(... ?
- by Cognize
Hi,
Just looking to clarify my understanding of the workings of the XmlWriter and abstract classes in general.
My thinking is (was) that an abstract class can not be instantiated, although it can contain base methods that can be used by an inheriting class.
So, while investigating XmlWriter, I find that to instantiate the XmlWriter, you call XmlWriter.Create(.... , which returns an instance of... XmlWriter, which can then be used:
FileStream fs = new FileStream("XML.xml", FileMode.Create);
XmlWriter w = XmlWriter.Create(fs);
XmlSerializer xmlSlr = new XmlSerializer(typeof(TestClass));
xmlSlr.Serialize(fs, tsIn);
This clearly works, as tested. Can anyone help me understand what is going on here. As far as I can see there is or should be no 'instance' to work with here??