我试图处理XmlWriter对象:
try
{
[System.Xml.XmlWriter] $writer = [System.Xml.XmlWriter]::Create('c:\some.xml')
}
finally
{
$writer.dispose()
}
错误:
Method invocation Failed because
[System.Xml.XmlWellFormedWriter]
doesn’t contain a method named
‘dispose’.
另一方面:
$writer -is [Idisposable]
# True
我该怎么办?