Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Article Writing
  4. Sample quoting

Sample quoting

Scheduled Pinned Locked Moved Article Writing
csharpasp-netcomhardwaretools
9 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jani Giannoudis
    wrote on last edited by
    #1

    In my article Web User Forms for ASP.NET[^] I have the following code sample:

    public void MyPublicMethod( object sender, EventArgs e )
    {
    System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo("C:\");
    // do something with dir
    } // MyPublicMethod

    protected void MyProtectedMethod( object sender, EventArgs e )
    {
    System.Diagnostics.Process.Start( "C:\AUTOEXEC.BAT" );
    } // MyProtectedMethod

    private void MyPrivateMethod( object sender, EventArgs e )
    {
    System.Threading.Thread.CurrentThread.Abort();
    } // MyPrivateMethod

    </script>

    <%Response.Write( "Embedded Code generated output." ); %></pre>
    Is there any workaround to fix the flaw syntax highlighting?
    <div class="signature">Cheers,
    Jani Giannoudis
    <a href="https://www.meerazo.com">Meerazo.com</a> - Resource Sharing Made Easy | Co-founder</div></x-turndown>

    L C 2 Replies Last reply
    0
    • J Jani Giannoudis

      In my article Web User Forms for ASP.NET[^] I have the following code sample:

      public void MyPublicMethod( object sender, EventArgs e )
      {
      System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo("C:\");
      // do something with dir
      } // MyPublicMethod

      protected void MyProtectedMethod( object sender, EventArgs e )
      {
      System.Diagnostics.Process.Start( "C:\AUTOEXEC.BAT" );
      } // MyProtectedMethod

      private void MyPrivateMethod( object sender, EventArgs e )
      {
      System.Threading.Thread.CurrentThread.Abort();
      } // MyPrivateMethod

      </script>

      <%Response.Write( "Embedded Code generated output." ); %></pre>
      Is there any workaround to fix the flaw syntax highlighting?
      <div class="signature">Cheers,
      Jani Giannoudis
      <a href="https://www.meerazo.com">Meerazo.com</a> - Resource Sharing Made Easy | Co-founder</div></x-turndown>

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      What you should do is explicitly set the language in each opeing PRE tag. Details can be found in this tip: Using PRE tags on Code Project[^] :)

      Luc Pattyn [My Articles] Nil Volentibus Arduum

      J 1 Reply Last reply
      0
      • L Luc Pattyn

        What you should do is explicitly set the language in each opeing PRE tag. Details can be found in this tip: Using PRE tags on Code Project[^] :)

        Luc Pattyn [My Articles] Nil Volentibus Arduum

        J Offline
        J Offline
        Jani Giannoudis
        wrote on last edited by
        #3

        Currently the pre tag lang is Javascript. Same issue with the pre tag cs.

        Cheers, Jani Giannoudis Meerazo.com - Resource Sharing Made Easy | Co-founder

        L 1 Reply Last reply
        0
        • J Jani Giannoudis

          Currently the pre tag lang is Javascript. Same issue with the pre tag cs.

          Cheers, Jani Giannoudis Meerazo.com - Resource Sharing Made Easy | Co-founder

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          There always have been some issues with the coloring as soon as string literals appear. I suspect too much Regex code has been used. What is it exactly you don't like? :)

          Luc Pattyn [My Articles] Nil Volentibus Arduum

          J 1 Reply Last reply
          0
          • L Luc Pattyn

            There always have been some issues with the coloring as soon as string literals appear. I suspect too much Regex code has been used. What is it exactly you don't like? :)

            Luc Pattyn [My Articles] Nil Volentibus Arduum

            J Offline
            J Offline
            Jani Giannoudis
            wrote on last edited by
            #5

            <script runat="server" language="C#">

            public void MyPublicMethod( object sender, EventArgs e )
            {
            System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo( "C:\" );
            // do something with dir
            } // MyPublicMethod

            protected void MyProtectedMethod( object sender, EventArgs e )
            {
            System.Diagnostics.Process.Start( "C:\AUTOEXEC.BAT" );
            } // MyProtectedMethod

            private void MyPrivateMethod( object sender, EventArgs e )
            {
            System.Threading.Thread.CurrentThread.Abort();
            } // MyPrivateMethod

            </script>

            <%Response.Write( "Embedded Code generated output." ); %>

            end-of-line #5 ); until line #21 <%Response.Write(

            Cheers, Jani Giannoudis Meerazo.com - Resource Sharing Made Easy | Co-founder

            L 1 Reply Last reply
            0
            • J Jani Giannoudis

              <script runat="server" language="C#">

              public void MyPublicMethod( object sender, EventArgs e )
              {
              System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo( "C:\" );
              // do something with dir
              } // MyPublicMethod

              protected void MyProtectedMethod( object sender, EventArgs e )
              {
              System.Diagnostics.Process.Start( "C:\AUTOEXEC.BAT" );
              } // MyProtectedMethod

              private void MyPrivateMethod( object sender, EventArgs e )
              {
              System.Threading.Thread.CurrentThread.Abort();
              } // MyPrivateMethod

              </script>

              <%Response.Write( "Embedded Code generated output." ); %>

              end-of-line #5 ); until line #21 <%Response.Write(

              Cheers, Jani Giannoudis Meerazo.com - Resource Sharing Made Easy | Co-founder

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              Jani Giannoudis wrote:

              ( "C:\" )

              That isn't valid C# code, either use @ or escape the backslash! As a result the code following it got comment colored, and the strings are in black. :)

              Luc Pattyn [My Articles] Nil Volentibus Arduum

              J 1 Reply Last reply
              0
              • L Luc Pattyn

                Jani Giannoudis wrote:

                ( "C:\" )

                That isn't valid C# code, either use @ or escape the backslash! As a result the code following it got comment colored, and the strings are in black. :)

                Luc Pattyn [My Articles] Nil Volentibus Arduum

                J Offline
                J Offline
                Jani Giannoudis
                wrote on last edited by
                #7

                Correct. In the initial code sample the backslash was escaped. The trick is to use the @"C:\" variant. Many thanks Luc!

                Cheers, Jani Giannoudis Meerazo.com - Resource Sharing Made Easy | Co-founder

                L 1 Reply Last reply
                0
                • J Jani Giannoudis

                  Correct. In the initial code sample the backslash was escaped. The trick is to use the @"C:\" variant. Many thanks Luc!

                  Cheers, Jani Giannoudis Meerazo.com - Resource Sharing Made Easy | Co-founder

                  L Offline
                  L Offline
                  Luc Pattyn
                  wrote on last edited by
                  #8

                  you're welcome. :)

                  Luc Pattyn [My Articles] Nil Volentibus Arduum

                  1 Reply Last reply
                  0
                  • J Jani Giannoudis

                    In my article Web User Forms for ASP.NET[^] I have the following code sample:

                    public void MyPublicMethod( object sender, EventArgs e )
                    {
                    System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo("C:\");
                    // do something with dir
                    } // MyPublicMethod

                    protected void MyProtectedMethod( object sender, EventArgs e )
                    {
                    System.Diagnostics.Process.Start( "C:\AUTOEXEC.BAT" );
                    } // MyProtectedMethod

                    private void MyPrivateMethod( object sender, EventArgs e )
                    {
                    System.Threading.Thread.CurrentThread.Abort();
                    } // MyPrivateMethod

                    </script>

                    <%Response.Write( "Embedded Code generated output." ); %></pre>
                    Is there any workaround to fix the flaw syntax highlighting?
                    <div class="signature">Cheers,
                    Jani Giannoudis
                    <a href="https://www.meerazo.com">Meerazo.com</a> - Resource Sharing Made Easy | Co-founder</div></x-turndown>

                    C Offline
                    C Offline
                    Chris Maunder
                    wrote on last edited by
                    #9

                    Apart from the string issue, I also set the language to HTML (though XML or ASP.NET will work the same) which has improved the colouring. This is ASP.NET, since it includes markup tags.

                    <script runat="server" language="C#">
                    public void MyPublicMethod( object sender, EventArgs e )
                    {
                    ...
                    }
                    </script>

                    This is javascript, because it's actual javascript, not Javascript embedded inside ASP.NET

                    public void MyPublicMethod( object sender, EventArgs e )
                    {
                    ...
                    }

                    cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups