Understanding .Single()
<p>[This is a really tough one to Google.]</p>

<p>Browsing sample code i'm seeing a usage i don't understand:</p>

<pre><code>var orderRow = order.Rows.Single();
</code></pre>

<p>Rows is an enumerable and usually one would iterate using a foreach loop. Is the .Single a workaround for cases where, for whatever reason, the foreach can't be (or need not) be used?</p>

<p>thx</p>

<p>In the time since the OP i've learned a bit more about usage that'll help other hits to this question:</p>

<pre><code>var option = options.OfType&lt;AdditionalLocationsOption&gt;().SingleOrDefault();
if (option != null){
...stuff
}
</code></pre>
