Find() public method

public Find ( ObjectHandle objectHandle ) : IntPtr
objectHandle ObjectHandle
return System.IntPtr
Exemplo n.º 1
0
        public override int IndexOf(T value)
        {
            switch (_argumentType)
            {
            case PropertyType.Object | PropertyType.Nullable:
                Argument.NotNull(value, nameof(value));

                var obj = Operator.Convert <T, RealmObject>(value);
                if (!obj.IsManaged)
                {
                    throw new ArgumentException("Value does not belong to a realm", nameof(value));
                }

                return(_listHandle.Find(obj.ObjectHandle));

            case PropertyType.String:
            case PropertyType.String | PropertyType.Nullable:
                return(_listHandle.Find(Operator.Convert <T, string>(value)));

            case PropertyType.Data:
            case PropertyType.Data | PropertyType.Nullable:
                return(_listHandle.Find(Operator.Convert <T, byte[]>(value)));

            default:
                return(_listHandle.Find(PrimitiveValue.Create(value, _argumentType)));
            }
        }
Exemplo n.º 2
0
        public int IndexOf(T item)
        {
            if (!item.IsManaged)
            {
                throw new ArgumentException("Value does not belong to a realm", nameof(item));
            }

            return((int)_listHandle.Find(item.ObjectHandle));
        }
Exemplo n.º 3
0
        public override int IndexOf(T 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(_listHandle.Find(realmValue));
        }