使用.NET 3.5 API访问Facebook C#SDK结果对象? [英] Accessing Facebook C# SDK result Object using .NET 3.5 API?
本文介绍了使用.NET 3.5 API访问Facebook C#SDK结果对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在.NET 3.5中使用以下内容(使用Bin\Net35\Facebook * .dll程序集):
Consider the following in .NET 3.5 (using the Bin\Net35\Facebook*.dll assemblies):
using Facebook;
var app = new FacebookApp();
var result = app.Get("me");
// want to access result properties with no dynamic
...在没有C#4.0 关键字this只提供通用的
对象
成员。
最好的我应该访问这个结果对象的Facebook属性吗?
... in the absence of the C# 4.0 dynamic
keyword this provides only generic object
members.
How best should I access the facebook properties of this result object?
在Facebook C#SDK中是否有帮助或实用方法或更强的类型,还是应该使用标准.NET反射技术?
Are there helper or utility methods or stronger types in the facebook C# SDK, or should I use standard .NET reflection techniques?
推荐答案
这个代码示例显示3.5用法,而不需要C#动态
关键字:
This code sample shows 3.5 usage, without needing the C# dynamic
keyword:
// Using IDictionary<string, object> (.Net 3.5)
var client = new FacebookClient();
var me = (IDictionary<string,object>)client.Get("me");
string firstName = (string)me["first_name"];
string lastName = (string)me["last_name"];
string email = (string)me["email"];
这篇关于使用.NET 3.5 API访问Facebook C#SDK结果对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文