I am querying a list of objects from my Parse server. I want to loop through each one and retrieve a value, given a key.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Parse;
using System.Diagnostics;
namespace Web.Pages
{
public class IndexModel : PageModel
{
public void OnGet()
{
Task<int> task = HandleMessagesAsync();
}
private async Task<int> HandleMessagesAsync()
{
var query = ParseObject.GetQuery("Message");
IEnumerable<ParseObject> results = await query.FindAsync();
foreach (var item in results)
{
var text = item.Get<"text">; // Not sure about this syntax
Debug.WriteLine("Result: " + text);
}
throw new NotImplementedException();
}
}
}
According to the guide: http://docs.parseplatform.org/dotnet/guide/#retrieving-objects
var text = item.Get<string>("text"); // Retrieve a value from field named "texted" with type "string"