Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 506981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:45:26+00:00 2026-05-13T06:45:26+00:00

I have a simple XElement object XElement xml = new XElement(XML, new XElement (TOKEN,Session[Token]),

  • 0

I have a simple XElement object

XElement xml = new XElement("XML",
    new XElement ("TOKEN",Session["Token"]),
    new XElement("ALL_INCLUSIVE", "0"),
    new XElement("BEACH", "0"),
    new XElement("DEST_DEP", ddlDest.SelectedValue.ToString()),
    new XElement("FLEX", "0")
);

Where want to dump out the contents into a string. Exactly like how Console.Writeline(xml); does, but I want the contents in a string. I tried various methonds. xml.ToString(); doesn’t return anything on its own.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:45:26+00:00Added an answer on May 13, 2026 at 6:45 am

    ToString should most definitely work. I use it all the time. What does it return for you in this case? An empty string? My guess is that something went wrong building your XElement. To debug, rewrite the code to add each of the child XElements separately, so that you can step through your code and check on each of them. Then before you execute the .ToString, in the Locals window, look at the [xml] variable expanded to xml.

    In short, your problem is happening before you ever get to the ToString() method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an XElement object which has a number of attributes and I simply
I have a simple Linq to XML query that i run and the results
I have a simple XML file: <?xml version=1.0 encoding=utf-8?> <ConvenioValidacao> <convenio ven_codigo=1 tipoValidacao=CPF></convenio> <convenio
I have a XML xElement like: <Play> <Trick Lead=E Win=S TNum=1>S3.S2.S4.SA></Trick> <Trick Lead=S Win=N
I have an XElement variable named content which consists of the following XML: <content>
I have this simple xml : <AllBands> <Band> <Name ID=1234 started=1962>Beatles<![CDATA[lalala]]></Name> <Last>1</Last> <Salary>2</Salary> </Band>
I have a simple XML, <S xmlns=\http://schemas.microsoft.com/winfx/2006/xaml/presentation\><H></H></S> I want to find all H nodes.
I have a simple XML file that looks something like: <Institutions> <FI name =
I have simple list: <ul> <li>some text 1 </li> <li>some text 2</li> <li>some text
I have simple static lib in xcode with the only class test.h: @interface TestClass

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.