ILovephp123 ILovephp123 - 9 months ago 35
C# Question

Hide or add new line to variable

Let's say I have this variable in my C# Code

string longVariableStuff = "hsduifgnw8e7rty83rfgediguidogy7834rghf7834ghf170934hf7034hgf734gf8170g437fg73408g1f784g1387fg4731gf7g13fg18347gf78134gf7834gf780134gfuhsdjkfhsdjkafhldsj";

Every time I'm coding, it gets a bit annoying when I scroll back it with the keyboard and my screen jumps to the right.

Is there anyway to just minimize it? Or maybe add a new line in the middle so I can view the whole thing without scrolling right?


Sure, you can just break it up:

string longVariableStuff = 
    "hsduifgnw8e7rty83rfgediguidogy7834rghf7834ghf170934hf7034hgf7" + 
    "34gf8170g437fg73408g1f784g1387fg4731gf7g13fg18347gf78134gf783" + 

This incurs absolutely no performance penalty, because the strings will be concatenated back into one string at compile time.