Exemplo n.º 1
0
        public override int IndexOf(T value)
        {
            Argument.NotNull(value, nameof(value));

            var realmValue = Operator.Convert <T, RealmValue>(value);

            if (realmValue.Type == RealmValueType.Object && !realmValue.AsRealmObject().IsManaged)
            {
                throw new ArgumentException("Value does not belong to a realm", nameof(value));
            }

            return(ResultsHandle.Find(realmValue));
        }
Exemplo n.º 2
0
        public override int IndexOf(T value)
        {
            Argument.NotNull(value, nameof(value));

            if (_argumentType != RealmValueType.Object)
            {
                throw new NotSupportedException("IndexOf on non-object results is not supported.");
            }

            var obj = value as RealmObjectBase;

            if (!obj.IsManaged)
            {
                throw new ArgumentException("Value does not belong to a realm", nameof(value));
            }

            return(ResultsHandle.Find(obj.ObjectHandle));
        }
Exemplo n.º 3
0
        public override int IndexOf(T value)
        {
            Argument.NotNull(value, nameof(value));

            if (_argumentType != (PropertyType.Object | PropertyType.Nullable))
            {
                throw new NotSupportedException("IndexOf on non-object results is not supported.");
            }

            var obj = Operator.Convert <T, RealmObject>(value);

            if (!obj.IsManaged)
            {
                throw new ArgumentException("Value does not belong to a realm", nameof(value));
            }

            return(ResultsHandle.Find(obj.ObjectHandle));
        }