Results 1 to 6 of 6

Thread: Line cannot exceed 2046 characters

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2003
    Posts
    89

    Line cannot exceed 2046 characters

    hello there,
    I'm relatively new to C#. I have to define a veeeeery long constant string and when I try to run an aspx page (Framework 1.1) containing this line of code:
    Code:
    private const string longString = "believe me this is very long [...]";
    I get a compilation error CS1034
    "Compiler limit exceeded: Line cannot exceed 2046 characters"

    Now, the MSDN isn't helping, it's just displaying this

    Do you know if there is any workaround to make it compile besides splitting the string into n pieces for subsequent concats into a variable? I'd really like to use a constant, this limitation is just silly if you ask me, expecially becuase if I had used VB.net I would have not encountered this problem.

    Also, do you know if C# can use its own version of that useful Vb.net underscore feature that make long lines more readable?

    Code:
    Const longString As String = "abcdefg" & _
    "hijklmnopq" & _
    "rstuvwxyz012...."
    Many thanks in advance
    Last edited by BrightSoul; Jun 27th, 2005 at 12:07 PM.
    - mo! I said MOOOOOOO!!
    - ...yep, that's a cow, alright.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width