That won't work as "valid C# code" - it will be treated as two lines of code:
string slsqt = "SELECT * FROM SalesTable WHERE
And
Year(SalesDate) > 2001";
The lack of a terminating double quote on the first line will give you an error, and you will get further errors for a missing function "Year", a missing variable "SalesDate", and a "what is that string doing in there?" for the double quotes.
You can do that if you turn off string escaping:
string slsqt = @"SELECT * FROM SalesTable WHERE
Year(SalesDate) > 2001";
will be treated as a single line, but ... the whitespace will then be treated as part of the string literal which makes the two pieces of code functionally different.
That's not the idea at all with layout changes! :laugh:
And ... you can't really do this automatically with a blunt instrument like a Regex: the amount of spacing you need depends on the indentation of the word
string
as well as the desired offset to "match up" the two parts of the literal.
If you want to faff about with layouts, then let VS do it for you: "Tools ... Options ... Text Editor ... C# ... Code style ... Formatting" gives you a wealth of options you can try.