Realm dotnet:从 RealmResults 按索引获取元素

Realm dotnet: get element by index from RealmResults

我正在使用 Xamarin 和 Realm 作为数据库来实现 android RecycleView。 RecycleView 需要通过索引访问数据源。有什么方法可以从 RealmResults 中按索引检索元素吗?我发现只需调用 realmResults.get(index) 方法就可以在领域 java 中实现。但显然 Realm 的 dotnet 实现没有这样的方法。

同样根据 Realm 文档:

Objects are not copied - you get a list of references to the matching objects, and you work directly with the original objects that match your query.

那么仅在 realmresults 上调用 .ToList() 并将此集合用作数据源就足够优化了吗?

Realm-Xamarin docs 说:

To extract a list of all users named John or Peter you would write:

var johnsAndPeters = realm.All<Person>().Where(p => 
  p.FirstName == "John" || 
  p.FirstName == "Peter"); 
var peopleList = johnsAndPeters.ToList();

The ToList call, in this example, fires off the query which maps straight to the Realm core.

Objects are not copied - you get a list of references to the matching objects, and you work directly with the original objects that match your query.

本质上是的,通过调用 ToList() 你获得了 Realm-Java.

中本质上是 RealmResults<T> 的东西

我们添加了一个issue to implement this exposed as ElementAt