Reading a xml tag containing ONE backslash but I get TWO backslash back?

Posted on 2009-04-30
Last Modified: 2012-05-06

I have a xml problem:

         this is part of my xml file:

            <?xml version="1.0" encoding="utf-8" standalone="yes" ?>

I want to read the tag "trennzeichen" with that method:      

str_Delimiter = xn_Portal.SelectSingleNode("trennzeichen").InnerText;

the result of str_Delimiter is "\\t"

why do I have TWO of those backslashes ? I write those data in a .txt file and for sure there are those TWO backslashes, but why?
Question by:MSFanboy
    LVL 28

    Accepted Solution

    In c#, the "\" has to be escaped by a "\". That means when you want a string to be:

    C:\Program Files

    you actually need to do this:

    string myString = "C:\\Program Files"

    When you output the string, you should only get one slash.

    Author Comment

    when I put \\t in the XML-tag I get FOUR "\\\\" not what I wanted.

    Author Comment

    ok the above error is only in debuging mode but in the .txt its written properly!!! thx

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now