public CcmErrorCode GetCcmSdkAttributes(out CcmNameValuePair[] attributes) { var ptrSize = Marshal.SizeOf(typeof(CcmNameValuePair)); var ptr = IntPtr.Zero; var result = Environment.Is64BitProcess ? CcmSdk64.CCMGetCCMAttributes(out uint count, ref ptr) : CcmSdk32.CCMGetCCMAttributes(out count, ref ptr); attributes = new CcmNameValuePair[count]; for (int i = 0; i < count; i++) { var nPtr = IntPtr.Add(ptr, i * ptrSize); attributes[i] = Marshal.PtrToStructure <CcmNameValuePair>(nPtr); } _ = Environment.Is64BitProcess ? CcmSdk64.CCMFreeNameValuePair(count, ptr) : CcmSdk32.CCMFreeNameValuePair(count, ptr); return((CcmErrorCode)result); }