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

GetStatusCodes() public static method

Unmarshals and frees an array of HRESULTs.
public static GetStatusCodes ( IntPtr &pArray, int size, bool deallocate ) : int[]
pArray System.IntPtr
size int
deallocate bool
return int[]
		public static int[] GetStatusCodes(ref IntPtr pArray, int size, bool deallocate)
		{
			if (pArray == IntPtr.Zero || size <= 0)
			{
				return null;
			}

			// unmarshal HRESULT array.
			int[] output = new int[size];
			Marshal.Copy(pArray, output, 0, size);

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

			return output;
		}