An examination of the code in Listing 2-1 begins with the member variable _Kinect and the property
named Kinect. An application should always maintain a local reference to the KinectSensor objects used
by the application. There are several reasons for this, which become more obvious as you proceed
through the book; however, at the very least, a reference is needed to uninitialize the KinectSensor when
the application is finished using the sensor. The property serves as a wrapper for the member variable.
The primary purpose of using a property is to ensure all sensor initialization and uninitialization is in a
common place and executed in a structured way. Notice in the property’s setter how the member
variable is not set unless the incoming value has a status of KinectStatus.Connected. When going
through the sensor discovery process, an application should only be concerned with connected devices.
Besides, any attempt to initialize a sensor that does not have a connected status results in an
InvalidOperationException exception.