For example:
root.Nodes.Add(new TNode() { Foo1 = bar1, Foo2 = bar2, Foo3 = bar3 });
or:
root.Nodes.Add(new TNode() { Foo1 = bar1,
Foo2 = bar2,
Foo3 = bar3 });
For example:
root.Nodes.Add(new TNode() { Foo1 = bar1, Foo2 = bar2, Foo3 = bar3 });
or:
root.Nodes.Add(new TNode() { Foo1 = bar1,
Foo2 = bar2,
Foo3 = bar3 });
I've done it both ways.. IMO it depends on the complexity of the initialization.
If it is simple 2 or 3 properties I will initialize on one line generally, but if i'm setting up an object with values for insertion into a database or something that has alot of properties i'll break it out like your second example.
Income income = new Income
{
Initials = something,
CheckNumber = something,
CheckDate = something,
BranchNumber = something
};
or
return new Report.ReportData { ReportName = something, Formulas = something};
Both notations are fine. I would simply suggest to use the first (1-line) notation whenever your line stay within 100 characters, and switch to the second (multi-line) notation whenever the expression is longer.
For longer stuff I do it this way:
root.Nodes.Add(new TNode() {
Foo1 = bar1,
Foo2 = bar2,
Foo3 = bar3
});