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 614359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:06:14+00:00 2026-05-13T18:06:14+00:00

Linq-to-Xml contains lots of methods that allow you to add arbitrary objects to an

  • 0

Linq-to-Xml contains lots of methods that allow you to add arbitrary objects to an xml tree. These objects are converted to strings by some means, but I can’t seem to find the specification of how this occurs. The conversion I’m referring to is mentioned (but not specified) in MSDN.

I happen to need this for javascript interop, but that doesn’t much matter to the question.

Linq to Xml isn’t just calling .ToString(). Firstly, it’ll accept null elements, and secondly, it’s doing things no .ToString() implementation does:

For example:

new XElement("elem",true).ToString() == "<elem>true</elem>"
//but...
true.ToString() == "True" //IIRC, this is culture invariant, but in any case...
true.ToString(CultureInfo.InvariantCulture) == "True"

Other basic data types are similarly specially treated.

So, does anybody know what it’s doing and where that’s described?

  • 1 1 Answer
  • 4 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-13T18:06:14+00:00Added an answer on May 13, 2026 at 6:06 pm

    Although I can’t find MSDN documentation to support this, when you do something like new XElement("bla",false) the System.Xml.XmlConvert class is uses to (de-)serialize the data in a non-localized fashion.

    In other words, if anyone else needs to know what exactly linq to xml does when you add a (non-xml) object into an xml tree, look at System.Xml.XmlConvert.

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

Sidebar

Related Questions

I am using Linq to XML for some HTML output files. I need to
i've been reading through the linq to xml documentation in msdn and some other
Me again... I have an XML File that contains different categories which I would
We gather lots of strings and send them to our clients in xml fragments.
I have a WIX XML document that contains 2,000+ file tags. I am trying
I am using Linq To XML to create XML that is sent to a
I have an xml file that contains a list of items i can deserialize
Trying to use Linq to XML for the first time and having some problems.
I have an XML document that contains a series of item nodes that look
I have a simple LINQ statement that returns a list of objects based on

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.