How to set up Visual studio 2010 so that multi-line lambda-functions will not look ugly, with all that empty space in the left?
dataView.CellFormatting += (s, e) =>
{
if ((e.ColumnIndex == 1)&&((dataView.SelectedCells.Count == 1)))
{
var scope = Scope.Instance;
var row = dataView.Rows[e.RowIndex];
var variable = row.DataBoundItem as Variable;
if (scope.Variables.Contains(variable))
{
dataView[e.ColumnIndex, e.RowIndex].Style.BackColor =
scope.GetGraph(variable).Color;
}
else
{
dataView[e.ColumnIndex, e.RowIndex].Style.BackColor = Color.White;
}
}
};
It depends on how much white space you consider ugly but one thing you can do to minimize it is hit a carriage return right after the equal. Then you end up with something like this. `
I usually hit CTRl-E CTRL-D right after making a change like this to get the document to auto-format (Edit->Advanced->Format Document)
(Just saw your amended post - when I put that in VS and hit return after the +=
Now that's odd — the indentation shouldn't go that far.
Try cutting and pasting it in place and Visual Studio should fix it for you on pasting. This is what I get: