Get the previous sibling node, remove the node you want to move from your parent, and paste it in front of the sibling.
XmlNode parent = priusNode.ParentNode. XmlNode previousNode = priusNode.PreviousSibling;
Error handling is ignored, but will be necessary for real implementation.
EDIT: Mike comment, calling RemoveChild is superfluous: as the docs say: "If newChild [in this case, priusNode] is already in the tree, it is removed from its original position and added to its target position." Thanks to Mike!
source share