C# 访问解析云代码结果 IDictionary test2=新字典 { {“username”,ParseUser.CurrentUser.username} }; var result=await ParseCloud.callfunctionsync(“getShiftCount”,test2); 系统.诊断.调试.写入(结果);

C# 访问解析云代码结果 IDictionary test2=新字典 { {“username”,ParseUser.CurrentUser.username} }; var result=await ParseCloud.callfunctionsync(“getShiftCount”,test2); 系统.诊断.调试.写入(结果);,c#,visual-studio-2013,parse-platform,parse-cloud-code,C#,Visual Studio 2013,Parse Platform,Parse Cloud Code,我使用解析云代码检索布尔值数组。我是C的新手,所以我假设数组被分配到result。但是如何访问数组的各个元素呢 现在我只得到System.Collections.Generic.List1[System.Object]ParseCloud.callfunctionsync是一种通用方法 根据,T是您将从云功能接收的数据类型 也就是说,如果您的getShiftCount返回一个列表,那么您应该重新格式化对该列表的函数调用: IDictionary<string, object> tes

我使用解析云代码检索布尔值数组。我是C的新手,所以我假设数组被分配到
result
。但是如何访问数组的各个元素呢


现在我只得到
System.Collections.Generic.List1[System.Object]
ParseCloud.callfunctionsync
是一种通用方法

根据,
T
是您将从云功能接收的数据类型

也就是说,如果您的
getShiftCount
返回一个
列表
,那么您应该重新格式化对该列表的函数调用:

IDictionary<string, object> test2 = new Dictionary<string, object>
            {
                { "username", ParseUser.CurrentUser.Username}
            };

        var result = await ParseCloud.CallFunctionAsync<Object>("getShiftCount", test2);

        System.Diagnostics.Debug.Write(result);

我不熟悉您正在调用的库,所以我不知道类型,但您可以像这样使用foreach构造:foreach(结果中的FooShiftCount元素){element.callsomethod();}通过谷歌搜索问题,第一个结果是100%匹配。请参阅“访问数组成员”一章。请自己做最少的研究。根据下面的答案,使用结果访问它[2]是不起作用的。如果答案解决了您的问题,那么请不要修改问题来修复您的下一个问题。问一个新问题,我的问题不是solved@nick9999请注意,不要复制和粘贴我的示例代码,我不知道您希望从云函数中得到什么类型的代码。相反,尝试理解函数的作用,并尝试自己修复它。如果失败了,我总是在这里帮助“对象”必须是“对象”,但除此之外,它是有效的。谢谢@nick9999我很高兴能帮上忙:)
var result = await ParseCloud.CallFunctionAsync<List<object>>("getShiftCount", test2);
int elementIndex = 2;
var element = result[elementIndex];