Beginner Q - long strings
-
Hello, I am working on my first project on C# after coming from C++ and I cannot seem to find out how to write long strings on multiple lines. It seems like
string longstr = "aaaa"
"bbbb";or
string longstr = "aaaa \
bbbb";do not work. Of course I can use the + operator, but I don't want to introduce an extra overhead. Thanks! Best regards, Alexandru Savescu P.S. Interested in art? Visit this!
-
Hello, I am working on my first project on C# after coming from C++ and I cannot seem to find out how to write long strings on multiple lines. It seems like
string longstr = "aaaa"
"bbbb";or
string longstr = "aaaa \
bbbb";do not work. Of course I can use the + operator, but I don't want to introduce an extra overhead. Thanks! Best regards, Alexandru Savescu P.S. Interested in art? Visit this!
string longstr = @"aaaa
bbbb";
:) MyDUMeter: a .NET DUMeter clone
"Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of." -
string longstr = @"aaaa
bbbb";
:) MyDUMeter: a .NET DUMeter clone
"Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."Thanks! ;) Best regards, Alexandru Savescu P.S. Interested in art? Visit this!
-
string longstr = @"aaaa
bbbb";
:) MyDUMeter: a .NET DUMeter clone
"Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."Me again! I tried your solution and of course it works, but when I take a look at the string in the debugger I am not satisfied with what I see. It semmes like my string contains lots of spaces between the last a and the first b. I didn't mean that, all I want is a way the compiler can concatenate my strings.... Best regards, Alexandru Savescu P.S. Interested in art? Visit this!
-
Me again! I tried your solution and of course it works, but when I take a look at the string in the debugger I am not satisfied with what I see. It semmes like my string contains lots of spaces between the last a and the first b. I didn't mean that, all I want is a way the compiler can concatenate my strings.... Best regards, Alexandru Savescu P.S. Interested in art? Visit this!
OK you have this then:
string longstr = "jsandjksajdhakhdkajshd" +
"asmndjashdkashdhaskdhk" +
"asmndjashdkashdhaskdhk" +
"asmndjashdkashdhaskdhk" +
"asmndjashdkashdhaskdhk".
ToString(); //just to show freeform, never neccesaryRemember C# is freeform. :) I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02