Skip to content

Instantly share code, notes, and snippets.

@prabirshrestha
Created September 29, 2012 01:04
Show Gist options
  • Save prabirshrestha/3802798 to your computer and use it in GitHub Desktop.
Save prabirshrestha/3802798 to your computer and use it in GitHub Desktop.
Facebook C# SDK generics
public class GenericFacebookClient : FacebookClient {
public T Get<T>(string path) {
return (T)base.Api(HttpMethod.Get, path, null, typeof(T));
}
public T Get<T>(string path, object parameters) {
return (T)base.Api(HttpMethod.Get, path, parameters, typeof(T));
}
}
var fb = new GenericFacebookClient();
var result = fb.Get<User>("me", null);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment