i use a database which is named LiteDB. this is a Nosql and free database for Dot-net. when i access my tables it returns a collection named 'LiteCollection'. I want to iterate over it. but it doesn't implement Getenumerator() method. and there is not any other indexing on it. i want to create an Ienumerable to set in on my Raddropdownlist(which is the name of Combo box in Telerik components). is there any way to do this?
using (var db = new LiteDatabase(@"MyData.db"))
{
// Get cookie collection
var Cookies2 = db.GetCollection<Cookie>("Cookies2");
Cookies2.EnsureIndex(x => x.Id);
foreach (var item in Cookies2) //it couldn't be done
{
}
// or
for (int i = 0; i < Cookies2.Count(); i++)
{
temp.Add(Cookies2.??)
}
}
Oops i find a simple way. Litecollection has a method which returns all objects. the FindAll() method do this.
foreach (var item in Cookies2.FindAll())
{
}