public NspiStatus GetMatches(Restriction restriction, object propName, int maxRows, IList <PropTag> propTags, out int[] mids, out PropRowSet rowset) { NspiStatus result; using (SafeRpcMemoryHandle safeRpcMemoryHandle = new SafeRpcMemoryHandle()) { if (restriction != null) { safeRpcMemoryHandle.Allocate(restriction.GetBytesToMarshalNspi()); restriction.MarshalToNativeNspi(safeRpcMemoryHandle); } int[] intArrayFromPropTagArray = NspiClient.GetIntArrayFromPropTagArray(propTags); this.MarshalStatToNative(); SafeRpcMemoryHandle rowsetHandle; NspiStatus matches = this.client.GetMatches(this.statHandle.DangerousGetHandle(), safeRpcMemoryHandle.DangerousGetHandle(), IntPtr.Zero, maxRows, intArrayFromPropTagArray, out mids, out rowsetHandle); this.MarshalNativeToStat(); rowset = NspiClient.GetRowSetAndDisposeHandle(rowsetHandle); result = matches; } return(result); }