You can do something like:, but you can't be sure about the index
because Select
without an orderby can result in an indeterminate order.
var itemWithIndex = db.Table<Profile>()
.Select((r, i) => new {Value =r, Index = i})
.FirstOrDefault(r=> r.Value.FolderPath == "C:\\");
if(itemWithIndex != null)
Console.WriteLine(itemWithIndex.Index);
To be sure about the order you can use OrderBy like:
var itemWithIndex = db.Table<Profile>()
.OrderBy(r=> r.FolderPath)
.Select((r, i) => new {Value =r, Index = i})
.FirstOrDefault(r=> r.Value.FolderPath == "C:\\");
I am not sure why you are avoiding an extra column to specify the ID
in the table. Probably its a better option, since this will remain same even in case of addition or updation of records.