鉴于以下简单代码,我如何传递状态对象,以便我的GetCompleted处理程序可以访问我需要的状态?在这种情况下,我需要GetCompleted处理程序中的friendlist的名称,但我认为没有办法传递它。
谢谢!
fbSync.GetCompleted += new EventHandler<FacebookApiEventArgs>(GetFriendListMembersCallback);
fbSync.GetAsync("/" + list.Id + "/members");
[...]
void GetFriendListMembersCallback(object sender, FacebookApiEventArgs e)
{
/* Here I also need my 'list' variable from the invoking scope, but how do I get it here? */
dynamic membersDataDynamic = (IDictionary<string, object>)e.GetResultData();
dynamic memberListDynamic = membersDataDynamic.data;
[...]
}
答案 0 :(得分:0)
State也称为用户令牌。
fb.GetAsync(path, parameters, state)