有没有人有任何用于 client.GetTaskAsync 的 FB C#SDK 示例?
任何指向该示例的指针都会很棒。
毗湿奴
结帐https://github.com/facebook-csharp-sdk/facebook-windows8-sample
private async void GraphApiAsyncDynamicExample()
{
try
{
var fb = new FacebookClient("access_token");
dynamic result = await fb.GetTaskAsync("me");
// You can either access it this way, using the .
dynamic id = result.id;
dynamic name = result.name;
// if dynamic you don't need to cast explicitly.
ProfileName.Text = "Hi " + name;
// or using the indexer
dynamic firstName = result["first_name"];
dynamic lastName = result["last_name"];
// checking if property exist
var localeExists = result.ContainsKey("locale");
// you can also cast it to IDictionary<string,object> and then check
var dictionary = (IDictionary<string, object>)result;
localeExists = dictionary.ContainsKey("locale");
}
catch (FacebookApiException ex)
{
// handle error
}
}