Created
September 29, 2012 01:04
-
-
Save prabirshrestha/3802798 to your computer and use it in GitHub Desktop.
Facebook C# SDK generics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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