Loop through collections
<p>I have two classes</p>

<pre><code>class A
{
    public string something { get; set; }
    public IList&lt;B&gt; b= new List&lt;B&gt;();
}

class B
{
    public string else { get; set; }
    public string elseelse { get; set; }
}
</code></pre>

<p>I have populated an object of class A called obj. How can I loop through this object and print values. Do I have to use two foreach's like the one show here or is there a better way?</p>

<pre><code> foreach (var z  in obj)
            {
                // print z.something;
                foreach (var x in z.b)
                {
                    // print x.elseelse;
                }
            }
</code></pre>
