Add new item to list before initializing or after?
Posted
by Kevin Pang
on Stack Overflow
See other posts from Stack Overflow
or by Kevin Pang
Published on 2010-04-01T00:57:20Z
Indexed on
2010/04/01
1:03 UTC
Read the original article
Hit count: 365
c#
Which do you prefer?
var foo = new Foo();
foo.Prop1 = "1";
foo.Prop2 = "2";
// etc...
this.Foos.Add(foo);
or
var foo = new Foo();
this.Foos.Add(foo);
foo.Prop1 = "1";
foo.Prop2 = "2";
// etc...
© Stack Overflow or respective owner