Syntax to add objects to a list?
<p>I am trying to find out the syntax to add a complex object into a list. Here's what I know works:</p>

<pre><code>ComplexObject temp = new ComplexObject() {attribute1 = 5, attribute2 = 6};
ComplexObjectList.Add(temp);
</code></pre>

<p>Here's what I'm wanting to do instead:</p>

<pre><code>ComplexObjectList.Add(new ComplexObject(){attribute1 = 5, attribute2 = 6});
</code></pre>

<p>I realize that it doesn't work, but is there any other way to add one to my list without creating one before hand? I have no need for temp other than this one function call.</p>
