A using block, with an object initializer block in the constructor
<p>If you <strong>call a constructor</strong> from a within a <strong>using statement</strong> the object is automatically disposed is wrapped it with a try/catch block. That is an object initializer block in the constructor.</p>

<p>But what becomes with member types that are initialized in the same statement? e.g:</p>

<pre><code>  class TypeThatThrowsAnException 
  {
       public TypeThatThrowsAnException() 
       {
           throw new Exception();
       }
  }

  using (SomeDisposable ds = new SomeDisposable() {
       MemberThatThrowsAnException m = new TypeThatThrowsAnException()
  })
  {
       // inside using statement
       ds.doSomething();
  }
</code></pre>

<p>What happens with <code>MemberThatThrowsAnException</code> when it throws an exception when SomeDisposable is initialized, i.e., the code block is executed?</p>

<p>And does it make any difference if we call those members constructors <strong>outside</strong> the scope of the <code>using</code> block?</p>

<pre><code>  class TypeThatThrowsAnException 
  {
       public TypeThatThrowsAnException() 
       {
           throw new Exception();
       }
  }

  class SomeClass 
  {
       public static TypeThatThrowsAnException StaticMember 
       {
          get
          {
               return new TypeThatThrowsAnException();
          }
       }
  } 

  using (SomeDisposable ds = new SomeDisposable() {
       MemberThatThrowsAnException = SomeClass.StaticMember
  })
  {
       // inside using statement
       ds.doSomething();
  }
</code></pre>

<p>In some scenarios this can be pretty nice and readable, but I would like to know if thare are any <strong>caveats or pitfalls</strong> in this way. Or that it is a <strong>no-go all the way</strong>. <em>Besides that you need to keep the readability in mind.</em></p>
