XmlComment: Strange behavior


can someone tell me, why this code works

Var commentNode As XmlNode = root.AppendChild(xml.CreateComment("Test"))

and this not?

Call root.AppendChild(xml.CreateComment("Test"))

What happens?

I don’t have any overriden XMLDocument methods in my project.

Dropping the Call doesn’t result in a compile error because AppendChild is overloaded with two signatures, one to return a value and one that doesn’t:


Adding Call confuses the compiler, it seems.

1 Like