Opc.Ua.Com.ComUtils.GetDateTimes C# (CSharp) Method

GetDateTimes() public static method

Unmarshals an array of WIN32 FILETIMEs as DateTimes.
public static GetDateTimes ( IntPtr &pArray, int size, bool deallocate ) : System.DateTime[]
pArray System.IntPtr
size int
deallocate bool
return System.DateTime[]
		public static DateTime[] GetDateTimes(ref IntPtr pArray, int size, bool deallocate)
		{
			if (pArray == IntPtr.Zero || size <= 0)
			{
				return null;
			}

			DateTime[] datetimes = new DateTime[size];

			IntPtr pos = pArray;

			for (int ii = 0; ii < size; ii++)
			{
				datetimes[ii] = GetDateTime(pos);
				pos = (IntPtr)(pos.ToInt64() + Marshal.SizeOf(typeof(System.Runtime.InteropServices.ComTypes.FILETIME)));
			}

			if (deallocate)
			{
				Marshal.FreeCoTaskMem(pArray);
				pArray = IntPtr.Zero;
			}

			return datetimes;
		}