Note: I cannot just write where T : IRealmObject, because it will broke interface implementation
phaseshift3/8/2023
That's all you can do
artem3/8/2023
can't I show that T is acceptable Type somehow else?
artem3/8/2023
like cast it
phaseshift3/8/2023
That's whatwhere is for
phaseshift3/8/2023
Where is compile time. You're trying to fix a compile problem with a run time check. No bueno
phaseshift3/8/2023
You can change All<T> to All<IRealm...> Then also use OfType I guess
phaseshift3/8/2023
That would not be efficient, I'm presuming
Message Not Public
Sign In and Join Server To See
3/8/2023
Message Not Public
Sign In and Join Server To See
3/8/2023
artem3/8/2023
publicIQueryable<T> Select<T>()
{
if (!typeof(T).IsSubclassOf(typeof(IRealmObject)))
thrownew TypeAccessException($"{typeof(T).Name} is not a subclass of {typeof(IRealmObject).Name}");
return realm?.All<IRealmObject>().OfType<T>();
}