Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Format multiline code to single line in Visual Studio

Is there a keyboard shortcut or fast way to change the code below to a single line in Visual Studio 2013? I also have ReSharper installed.

Multi

new XElement("Option",
            new XAttribute("Name", "FileDelete"),
            "1"
        ),

Single

new XElement("Option", new XAttribute("Name", "FileDelete"),"1" ),
like image 201
Mike Flynn Avatar asked Jun 13 '14 13:06

Mike Flynn


People also ask

How do I convert multiple lines to single line in Visual Studio?

1 Answer. Show activity on this post. Mark code that you want to convert to single line, press F1 , type join lines press Enter and voila!

How do you change multiple lines in VS code?

Select the lines you want and then press: Windows: Shift + Alt + i. Mac: shift + option + i.

How do you remove spaces from multiple lines in VS code?

You can select all and use SHIFT + TAB to unindent. Show activity on this post. =>for multiline at same time you can use Shift + Alt + Up/Down arrow key then edit your code or remove/add space. =>you can edit more then one line at same time in anywhere in code press and hold Alt key then click on lines with mouse.


1 Answers

Just select all the text

and press (control + j)

and it will become 1 line of code

like image 182
vikas aggarwal Avatar answered Sep 20 '22 23:09

vikas aggarwal