static CFNumber SetLimit(CFMutableDictionary dict, int max) { CFNumber n = null; IntPtr val; if (max == -1) { val = MatchLimitAll; } else if (max == 1) { val = MatchLimitOne; } else { n = CFNumber.FromInt32(max); val = n.Handle; } dict.SetValue(val, SecKeyChain.MatchLimit); return(n); }