I have pasted some code that looks like this:
Dto = new MyDto()
{
SessionId = sessionId.ToString(),
UserName = username,
License = allocateLicense
},
but the pasted version looks like:
Dto = new MyDto
()
{
SessionId =
sessionId.
ToString(),
UserName =
username,
License =
allocateLicense
},
I tried control-z (undo) and sometimes with simple pieces of code it reformats correctly but for other code it stays as above with line breaks.
So is there a way I can select the pasted code and reformat it so that the additional line breaks are removed?
If the problem is automatic formatting on paste you can of course disable it. If it’s the other way around you can do the same as well..
Visual Studio > Tools > Options > Text Editor > C# > Formatting
appropriately set Automatically format on paste