Convert C# "writer.Write(@" to VB ?

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

    #1

    Convert C# "writer.Write(@" to VB ?

    I'm trying to convert the following statement to VB.NET:
    writer.Write(@" <some html here>");

    I tried simply removing the semicolon, but VB chokes on the @-sign.
    Unfortunately, when searching online, I can't find any information on what
    this actually does in the c# code, otherwise I'd simply remove it. What
    does the @ symbolize, here, and how can I effectively rewrite this in VB?

    Thanks in advance.

    bh


  • Chris Fulstow

    #2
    Re: Convert C# &quot;writer.Wr ite(@&quot; to VB ?

    The "@" sign makes it a verbatim string, so you don't need to escape
    backslashes.
    More info:


    bh wrote:
    I'm trying to convert the following statement to VB.NET:
    writer.Write(@" <some html here>");
    >
    I tried simply removing the semicolon, but VB chokes on the @-sign.
    Unfortunately, when searching online, I can't find any information on what
    this actually does in the c# code, otherwise I'd simply remove it. What
    does the @ symbolize, here, and how can I effectively rewrite this in VB?
    >
    Thanks in advance.
    >
    bh

    Comment

    • rmacias

      #3
      RE: Convert C# &quot;writer.Wr ite(@&quot; to VB ?

      Take out the @ character. In C# this tells the compiler ignore escape
      squences such as "\n" and "\r", etc.

      For example: Console.WriteLi ne("Hello\nWorl d") will output :

      Hello
      World

      But Console.WriteLi ne(@"Hello\Worl d") will output:

      Hello\nWorld

      "bh" wrote:
      I'm trying to convert the following statement to VB.NET:
      writer.Write(@" <some html here>");
      >
      I tried simply removing the semicolon, but VB chokes on the @-sign.
      Unfortunately, when searching online, I can't find any information on what
      this actually does in the c# code, otherwise I'd simply remove it. What
      does the @ symbolize, here, and how can I effectively rewrite this in VB?
      >
      Thanks in advance.
      >
      bh
      >
      >
      >

      Comment

      • Christof Nordiek

        #4
        Re: Convert C# &quot;writer.Wr ite(@&quot; to VB ?

        you can't find any information about it?
        In the C#-documentation look for string or string literal.
        In short the @ changes the characters and escape sequences that can be used
        in a string literal.
        since the verbatim string literal is very Basic like, removing the @ will be
        right.

        (the @ in C# also has another meaning in connection with
        keywords/indentifiers)

        "bh" <NoSpam@ReplyTo Group.comschrie b im Newsbeitrag
        news:%23h5efVh7 GHA.3644@TK2MSF TNGP03.phx.gbl. ..
        I'm trying to convert the following statement to VB.NET:
        writer.Write(@" <some html here>");
        >
        I tried simply removing the semicolon, but VB chokes on the @-sign.
        Unfortunately, when searching online, I can't find any information on what
        this actually does in the c# code, otherwise I'd simply remove it. What
        does the @ symbolize, here, and how can I effectively rewrite this in VB?
        >
        Thanks in advance.
        >
        bh
        >

        Comment

        • Jon   Paal

          #5
          Re: Convert C# &quot;writer.Wr ite(@&quot; to VB ?

          vb doesn't require the "@" sign -- dump it too..



          "bh" <NoSpam@ReplyTo Group.comwrote in message news:%23h5efVh7 GHA.3644@TK2MSF TNGP03.phx.gbl. ..
          I'm trying to convert the following statement to VB.NET:
          writer.Write(@" <some html here>");
          >
          I tried simply removing the semicolon, but VB chokes on the @-sign. Unfortunately, when searching online, I can't find any
          information on what this actually does in the c# code, otherwise I'd simply remove it. What does the @ symbolize, here, and how
          can I effectively rewrite this in VB?
          >
          Thanks in advance.
          >
          bh
          >

          Comment

          • Herfried K. Wagner [MVP]

            #6
            Re: Convert C# &quot;writer.Wr ite(@&quot; to VB ?

            "bh" <NoSpam@ReplyTo Group.comschrie b:
            I'm trying to convert the following statement to VB.NET:
            writer.Write(@" <some html here>");
            Simply remove the '@':

            C# Programmer's Reference -- 'string'
            <URL:http://msdn.microsoft. com/library/en-us/csref/html/vclrfString.asp >

            --
            M S Herfried K. Wagner
            M V P <URL:http://dotnet.mvps.org/>
            V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

            Comment

            Working...