It creates an instance of a class that inherits XmlWriter and returns it, downcast to its base class. This is a form of Polymorphism, which allows multiple types to be handled by the same code.
If you debug this code, you can see the type returned by Create.
A quick peek at Reflector shows the types created by this method:
switch (this.OutputMethod)
{
case XmlOutputMethod.Xml:
if (!this.Indent)
{
writer = new XmlEncodedRawTextWriter(output, this);
}
else
{
writer = new XmlEncodedRawTextWriterIndent(output, this);
}
goto Label_010B;
case XmlOutputMethod.Html:
if (!this.Indent)
{
writer = new HtmlEncodedRawTextWriter(output, this);
}
else
{
writer = new HtmlEncodedRawTextWriterIndent(output, this);
}
goto Label_010B;
case XmlOutputMethod.Text:
writer = new TextEncodedRawTextWriter(output, this);
goto Label_010B;
case XmlOutputMethod.AutoDetect:
writer = new XmlAutoDetectWriter(output, this);
goto Label_010B;
}
return null;
}
switch (this.OutputMethod)
{
case XmlOutputMethod.Xml:
if (!this.Indent)
{
writer = new XmlUtf8RawTextWriter(output, this);
}
else
{
writer = new XmlUtf8RawTextWriterIndent(output, this);
}
goto Label_010B;
case XmlOutputMethod.Html:
if (!this.Indent)
{
writer = new HtmlUtf8RawTextWriter(output, this);
}
else
{
writer = new HtmlUtf8RawTextWriterIndent(output, this);
}
goto Label_010B;
case XmlOutputMethod.Text:
writer = new TextUtf8RawTextWriter(output, this);
goto Label_010B;
case XmlOutputMethod.AutoDetect:
writer = new XmlAutoDetectWriter(output, this);
goto Label_010B;
All these implementations (e.g., XmlEncodedRawTextWriter) are internal.