Im working on a local application that uses Google Analytics V3 API. Im using ga:visitors to get number of visits and GaData property "TotalsForAllResults" to get all visitors. However TotalForAllResults is a dictionary that uses ` with key value pair "ga:visitors" and "number of visitors". This is what the debugger shows:
My problem is im uncertain how to format the dictionary in order to desplay the result with Console.WriteLine. If i run the application i can see the total number when debugging but if i runn "TotalForAllReason" with console rightline i get -
After modifying a bit it looks like this (Thx Papa:
foreach (KeyValuePair<string, string> kvp in d.TotalsForAllResults) { Console.WriteLine("Antal Besök:" +" " + kvp.Value); } Console.WriteLine(d.TotalsForAllResults.Keys + " = " + d.TotalsForAllResults.Values); Console.ReadLine();
This is the output i get now:
Is Generic.List etc indicating that there is more to show or why does this message appear?
Anny suggestions?
Thx
If it's a keyvaluepair, you can do this. Hope the syntax is right.
Console.WriteLine(d.TotalForAllReason[0].Key + " = " + d.TotalForAllReason[0].Value);
If you have more than one record, you can do this:
foreach (KeyValuePair kvp in d.TotalForAllReason) {
Console.WriteLine(kvp.Key + " = " + kvp.Value);
}