数组转换为字符串

本文关键字:字符串 转换 数组 | 更新日期: 2023-09-27 18:06:54

我有这样的代码:

dynamic friends = fb.Get("/me/friends");
var friend = friends.name;

如何从动态好友对象中获取信息?我使用的是facebook sdk 5.2.

数组转换为字符串

try

List<string> myFriendNames = (from f in friends.data select f.name).ToList();

编辑-按注释:

foreach (string fn in myFriendNames)
{ rtb.AppendText (fn + Environment.NewLine); }

try

var fb = new FacebookWebClient();
dynamic myFriends = fb.Get("me/friends");
foreach (var friend in myFriends.data)
{
    // u can get friend.name here
}