Exemplo n.º 1
0
        public static double FromNSNumber(IntPtr handle)
        {
            if (handle == IntPtr.Zero)
            {
                return(default(double));
            }

            return(ObjC.MessageSendDouble(handle, "doubleValue"));
        }
Exemplo n.º 2
0
        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));
        }