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

GetFILETIMEs() public static method

Marshals an array of DateTimes into an unmanaged array of FILETIMEs
public static GetFILETIMEs ( System.DateTime datetimes ) : IntPtr
datetimes System.DateTime The array of DateTimes to marshal
return System.IntPtr
		public static IntPtr GetFILETIMEs(DateTime[] datetimes)
		{
			int count = (datetimes != null)?datetimes.Length:0;

			if (count <= 0)
			{
				return IntPtr.Zero;
			}

			IntPtr pFiletimes = Marshal.AllocCoTaskMem(count*Marshal.SizeOf(typeof(System.Runtime.InteropServices.ComTypes.FILETIME)));

			IntPtr pos = pFiletimes;

			for (int ii = 0; ii < count; ii++)
			{
				Marshal.StructureToPtr(GetFILETIME(datetimes[ii]), pos, false);
				pos = (IntPtr)(pos.ToInt64() + Marshal.SizeOf(typeof(System.Runtime.InteropServices.ComTypes.FILETIME)));
			}

			return pFiletimes;
		}	

Same methods

ComUtils::GetFILETIMEs ( IntPtr &pArray, int size ) : System.Runtime.InteropServices.ComTypes.FILETIME[]