Geeks With Blogs
Joe Mayo

The first annual Chirp has been scheduled for 14-15 April in San Francisco. Chirp is a conference, sponsored by Twitter, about the Twitter platform.

http://chirp.twitter.com

To attend the conference, you'll need to obtain the password by executing the users/show command. There are plenty of tools to help you do this if you have some degree of programming skill.  Of course, there is a .NET LINQ provider, LINQ to Twitter, that can help perform this task with ease.  In LINQ to Twitter terms, you would perform a Show query on the User entity, like this:

var user =
    (from tweet in twitterCtx.User
     where tweet.Type == UserType.Show &&
     tweet.ID == "6253282"
     select tweet)
     .SingleOrDefault();

Console.WriteLine(
    "The password to Chirp is: {0}",
    user.Identifier.ScreenName);

Based on a TwitterContext instance, twitterCtx, you can perform a user's query. There are a few different types of user querys you can make, including Show, Followers, and Friends.  In the current case, we're interested in finding the user who's Twitter ID is 6253282. In typical LINQ syntax, we're only querying for one user, so SingleOrDefault materializes that user for us.  Because queries can be based on ID, UserID, and Screen name, I designed LINQ to Twitter with a special Identifier property that held these values as returned from Twitter.  Therefore, if you want to see what you used to create the query, use the properties directly off the returned User object, If you want to see what Twitter returned, drill down into the Identifier property, as shown in the Console.WriteLine statement of the previous example.

Normally, my code comes with the output to show you the results, but considering the mission what fun would that be?

Joe

Posted on Monday, January 25, 2010 10:55 PM C# , Twitter , LINQ , LINQ to Twitter | Back to top

Copyright © Joe Mayo | Powered by: GeeksWithBlogs.net