private static void AddQueryLessThan(QueryHandle queryHandle, string columnName, object value) { var columnIndex = NativeQuery.get_column_index((QueryHandle)queryHandle, columnName, (IntPtr)columnName.Length); var valueType = value.GetType(); if (valueType == typeof(int)) { NativeQuery.int_less((QueryHandle)queryHandle, columnIndex, (IntPtr)((int)value)); } else if (valueType == typeof(long)) { NativeQuery.long_less((QueryHandle)queryHandle, columnIndex, (long)value); } else if (valueType == typeof(float)) { NativeQuery.float_less((QueryHandle)queryHandle, columnIndex, (float)value); } else if (valueType == typeof(double)) { NativeQuery.double_less((QueryHandle)queryHandle, columnIndex, (double)value); } else if (valueType == typeof(DateTimeOffset)) { NativeQuery.timestamp_milliseconds_less(queryHandle, columnIndex, ((DateTimeOffset)value).ToRealmUnixTimeMilliseconds()); } else if (valueType == typeof(string) || valueType == typeof(bool)) { throw new Exception("Unsupported type " + valueType.Name); } else { throw new NotImplementedException(); } }