/// <summary>
        /// Unmarshals and deallocates an OPCHDA_ITEM structure.
        /// </summary>
        internal static TsCHdaItemValueCollection GetItemValueCollection(OpcRcw.Hda.OPCHDA_ITEM input, bool deallocate)
        {
            TsCHdaItemValueCollection output = new TsCHdaItemValueCollection();

            output.ClientHandle = input.hClient;
            output.Aggregate    = input.haAggregate;

            object[]   values     = Com.Interop.GetVARIANTs(ref input.pvDataValues, input.dwCount, deallocate);
            DateTime[] timestamps = Technosoftware.DaAeHdaClient.Utilities.Interop.GetDateTimes(ref input.pftTimeStamps, input.dwCount, deallocate);
            int[]      qualities  = Technosoftware.DaAeHdaClient.Utilities.Interop.GetInt32s(ref input.pdwQualities, input.dwCount, deallocate);

            for (int ii = 0; ii < input.dwCount; ii++)
            {
                Technosoftware.DaAeHdaClient.Hda.TsCHdaItemValue value = new Technosoftware.DaAeHdaClient.Hda.TsCHdaItemValue();

                value.Value            = values[ii];
                value.Timestamp        = timestamps[ii];
                value.Quality          = new Technosoftware.DaAeHdaClient.Da.TsCDaQuality((short)(qualities[ii] & 0x0000FFFF));
                value.HistorianQuality = (Technosoftware.DaAeHdaClient.Hda.TsCHdaQuality)((int)(qualities[ii] & 0xFFFF0000));

                output.Add(value);
            }

            return(output);
        }