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

GetGUIDs() public static method

Unmarshals an array of WIN32 GUIDs as Guid.
public static GetGUIDs ( IntPtr &pInput, int size, bool deallocate ) : System.Guid[]
pInput System.IntPtr
size int
deallocate bool
return System.Guid[]
		public static Guid[] GetGUIDs(ref IntPtr pInput, int size, bool deallocate)
		{
			if (pInput == IntPtr.Zero || size <= 0)
			{
				return null;
			}

			Guid[] guids = new Guid[size];

			IntPtr pos = pInput;

			for (int ii = 0; ii < size; ii++)
			{
				GUID input = (GUID)Marshal.PtrToStructure(pInput, typeof(GUID));

				guids[ii] = new Guid(input.Data1, input.Data2, input.Data3, input.Data4);
				
				pos = (IntPtr)(pos.ToInt64() + Marshal.SizeOf(typeof(GUID)));
			}

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

			return guids;
		}