BodyManager.OnApplicationQuit C# (CSharp) Method

OnApplicationQuit() private method

private OnApplicationQuit ( ) : void
return void
    void OnApplicationQuit()
    {
        //If we have a data reader
        if( reader != null )
        {
            //Dispose of it
            reader.Dispose();
            reader = null;
        }

        //If we have a sensor
        if( sensor != null )
        {

            //If a connection is open, close it
            if( sensor.IsOpen )
            {
                sensor.Close();
            }

            //Get rid of the reference
            sensor = null;
        }
        
    }
}