Facebook C# SDK - .NET 3.5 & Dynamic objects

前端 未结 4 1122
难免孤独
难免孤独 2021-02-06 15:53

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 re

4条回答
  •  盖世英雄少女心
    2021-02-06 16:16

    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("/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; }
    }
    

提交回复
热议问题