In C# Return XElement without descendants

kanuma

New Member
Sure this is simple, but it's alluding me at the moment, i want to return the top level node of an XDocument as an XElement, but without returning any of it's descendants:Looking for something along the lines of below, but it doesn't work\[code\]XElement myElement = myXDocument.Root.Element();\[/code\]WANT TO RETURN ONLY\[code\]<Response xmlns="someurl" xmlnsLi="thew3url"></Response>\[/code\]FROM\[code\] <Response xmlns="someurl" xmlnsLi="thew3url"> <ErrorCode></ErrorCode> <Status>Success</Status> <Result> <Manufacturer> <ManufacturerID>46</ManufacturerID> <ManufacturerName>APPLE</ManufacturerName> </Manufacturer> </Result> </Response>\[/code\]
 
Back
Top