public IDictionary <IOHIDElement, IOHIDValue> GetValues(IOHIDElement[] elements) { ThrowIfDisposed(); if (elements == null) { throw new ArgumentNullException("elements"); } var elementArray = CFArray.FromNativeObjects(elements); IOHIDElement[] keys = new IOHIDElement[elements.Length]; IOHIDValue[] values = new IOHIDValue[elements.Length]; CFDictionary multiple = CFDictionary.FromObjectsAndKeys(values, keys); var multipleRef = multiple.Handle; var result = IOHIDDeviceCopyValueMultiple(Handle, elementArray.Handle, ref multipleRef); IOObject.ThrowIfError(result); var dict = new Dictionary <IOHIDElement, IOHIDValue> (multiple.Count); IntPtr[] keyRefs, valueRefs; multiple.GetKeysAndValues(out keyRefs, out valueRefs); for (int i = 0; i < multiple.Count; i++) { dict.Add(new IOHIDElement(keyRefs [i], true), new IOHIDValue(valueRefs [i], true)); } CFType.Release(multiple.Handle); return(dict); }