StringBuilder

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jason

    #1

    StringBuilder

    Why is the following code producing the below resuts

    Dim msMessage(0) = New StringBuilder(

    msMessage(0).In sert(0, "<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap .org/soap/envelope/'"
    msMessage(0).In sert(1, "xmlns:xsi='htt p://www.w3.org/1999/XMLSchema-instance'"
    msMessage(0).In sert(2, "xmlns:xsd='htt p://www.w3.org/1999/XMLSchema'>"
    =============== =============== =============== =============== =============== =
    <xxmlns:xsd='ht tp://www.w3.org/1999/XMLSchema'>mlns :xsi='http://www.w3.org/1999/XMLSchema-instance'SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap .org/soap/envelope/

    Why is everything going in backwards?
  • Jon Skeet [C# MVP]

    #2
    Re: StringBuilder

    Jason <anonymous@disc ussions.microso ft.com> wrote:[color=blue]
    > Why is the following code producing the below resuts?
    >
    > Dim msMessage(0) = New StringBuilder()
    >
    > msMessage(0).In sert(0, "<SOAP-ENV:Envelope
    > xmlns:SOAP-ENV='http://schemas.xmlsoap .org/soap/envelope/'")
    > msMessage(0).In sert(1,
    > "xmlns:xsi='htt p://www.w3.org/1999/XMLSchema-instance'")
    > msMessage(0).In sert(2,
    > "xmlns:xsd='htt p://www.w3.org/1999/XMLSchema'>")
    > =============== =============== =============== =============== =============== ==
    > <xxmlns:xsd='ht tp://www.w3.org/1999/XMLSchema'>mlns :xsi='http://www.w
    > 3.org/1999/XMLSchema-instance'SOAP-ENV:Envelope
    > xmlns:SOAP-ENV='http://schemas.xmlsoap .org/soap/envelope/'
    >
    > Why is everything going in backwards?[/color]

    Because you're using StringBuilder.I nsert when I think you really want
    StringBuilder.A ppend. Look carefully at the docs for
    StringBuilder.I nsert.

    --
    Jon Skeet - <skeet@pobox.co m>
    Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

    If replying to the group, please do not mail me too

    Comment

    Working...