我正在查询Parse服务器中的对象列表。我想循环遍历每一个,并在给定密钥的情况下检索一个值。
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();
}
}
}
答案 0 :(得分:0)
根据指南:http://docs.parseplatform.org/dotnet/guide/#retrieving-objects
var text = item.Get<string>("text"); // Retrieve a value from field named "texted" with type "string"