M
mike
I have a function that is being called from code. The XDocument that I
am passing into the function is being mutated and I would like to know
why. See the example below...
Class Myclass
Public Sub CreateXml
Dim siteDoc = XDocument.Load(siteXmlPath)
Dim contentWithoutSectionElements As XDocument =
RemoveSectionsFromDocument(siteDoc)
End Sub
Private Function RemoveSectionsFromDocument(ByVal srcdoc As
XDocument) As XDocument
srcdoc...<section>.Remove()
Return srcdoc
End Function
End Class
In the debugger, siteDoc now no longer has <section> elements. It's
like the parameter has been passed ByRef rather than ByVal.
Hope someone can answer this. I'm completely baffled by this one.
Thanks
Mike
am passing into the function is being mutated and I would like to know
why. See the example below...
Class Myclass
Public Sub CreateXml
Dim siteDoc = XDocument.Load(siteXmlPath)
Dim contentWithoutSectionElements As XDocument =
RemoveSectionsFromDocument(siteDoc)
End Sub
Private Function RemoveSectionsFromDocument(ByVal srcdoc As
XDocument) As XDocument
srcdoc...<section>.Remove()
Return srcdoc
End Function
End Class
In the debugger, siteDoc now no longer has <section> elements. It's
like the parameter has been passed ByRef rather than ByVal.
Hope someone can answer this. I'm completely baffled by this one.
Thanks
Mike