I have downloaded the Graph C# SDK for facebook, the examples are very helpful and easy to understand however i come unstuck when trying to use the dynamic object type as the return object for a FacebookApp.Get("me") call.
I'v never used dynamics before so i did a bit of reasearch and it seems they are new to Visual Studio 2010, which is the version i am using but i cant use the latest framework because of my production environment...
Is there a type i can use instead or is there a different way to go about this using the 3.5 framework? here is an example from the source files provided with the binary for the framework.
dynamic myInfo = app.Get("me");
lblTitle.Text = myInfo.name;
I get an error stating that i may be missing an assembely reference for type dynamic.
Any and all help is greatly apreciated! looking forward to getting to grips with this SDK!!
If you want strongly typed objects there is a very easy way to do that. See here: https://gist.github.com/906471
var fb = new FacebookClient("access_token");
var result = fb.Get<FBUser>("/me");
string name = result.Name;
MessageBox.Show("Hi " + name);
[DataContract]
public class FBUser {
[DataMember(Name="name")]
public string Name { get; set; }
[DataMember(Name="first_name")]
public string FirstName { get; set; }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With