Saturday, August 6, 2011

.Add(one) versus .AddRange(many)

How to add a collection to a List<T> in contrast to just adding a single one-off item:

List<Foo> myFoo = new List<Foo>();

myFoo.Add(bar);

myFoo.AddRange(baz.FooChildren);

No comments:

Post a Comment