title: C# class representing a USB device
body: <p>I'm writing a wrapper class in C# for a USB device (using P/Invoke to communicate with it). The device needs to be sent an open message before use, and a close method when it's done with. In my constructor I want to try to open the device and return <code>null</code> if that call fails for whatever reason. I'll also write a <code>Dispose()</code> which calls the close method on the device.</p>
  
  <p>Is this a sensible way to code it? Or should I have a separate <code>ConnectToDevice</code> method?</p>
  
  <p>By putting it in the constructor I hope users of my class can simply write:</p>
  
  <pre><code>USBDevice myDevice = new USBDevice()
  
  if (myDevice != null) {
    myDevice.PerformAction();
    myDevice.Dispose();
    myDevice = null;
  }
  </code></pre>