How to parse "ViewResult" to a generic list



My project is a web api project. I have a class called forumVeri. I send query to my bucket’s view.

var result = myBucket.Query<forumVeri>(querymain);

when I debug, result’s type is {Couchbase.Views.ViewResult<forumVeri>} but I want to parse it to a generic list. How can I do it?



@HandeBc -

The ViewResult object has a Rows property that contains the results of the View request. The signature looks like this: IEnumerable<ViewRow<T>> Rows{get;} - each ViewRow has a Value which is typed to T, in your case it would be a forumVeri. Something like this:

 var result = client.Execute<Beer>(query);
 foreach (var beer in result.Rows.Select(x=>x.Value))