public static double FromNSNumber(IntPtr handle) { if (handle == IntPtr.Zero) { return(default(double)); } return(ObjC.MessageSendDouble(handle, "doubleValue")); }
public static DateTime FromNSDate(IntPtr handle) { if (handle == IntPtr.Zero) { return(default(DateTime)); } double secondsSinceReferenceDate = ObjC.MessageSendDouble(handle, "timeIntervalSinceReferenceDate"); if (secondsSinceReferenceDate < -63113904000) { return(DateTime.MinValue); } if (secondsSinceReferenceDate > 252423993599) { return(DateTime.MaxValue); } return(new DateTime((long)(secondsSinceReferenceDate * 10000000 + 6.3113904E+17), DateTimeKind.Utc)); }