.NET Client Get Part of values of View Query Results

net

#1

Hi all,

When I query View and get rows format of results like this:

Key : "20160217"
Values: [“198834”,“341”]

var view = _client.GetView(“byhour”, “by_day”).Key(day).Stale(StaleMode.False);
int i=0;
foreach (var row in view)
{
var values = row.Info[“value”]; // list objects
//But I cant get second value of this values.
pageview = values[2]; //error because ‘values’ type ‘object’ not is an array. But it debug i see values is list objects.
}


#2

Hi @Sonrobby,
In .NET array and list’s are 0 indexed, meaning that 0 is the first element in the list and 1 is the second.

If the above answer is not what you are looking for then you perhaps need to cast the the JSON result to a List, using JSON.NET is very popular in .NET. You can see a sample here:
http://www.newtonsoft.com/json/help/html/SerializingJSON.htm

I hope this helps
Martin