Today, I released LINQ to Twitter v3.0.2. This release takes LINQ to Twitter v3.0 out of beta and into a stable release. The primary features of this release are async commands/queries and Portable Class Library (PCL) support.
The async support makes your application more responsive to the user, increases server scalability, and makes coding simpler (especially in technologies like Windows Phone where async is required). Here's an example of how to perform an async query:
var tweets =
(from tweet in twitterCtx.Status
where tweet.Type == StatusType.Home
The code above will return a tweet from the Home timeline. Notice the await keyword and the use of the ToListAsync operator. Additionally, you can invoke async commands, shown here:
var tweet = await twitterCtx.TweetAsync(status);
In the code above, status is text that you want to send to Twitter and tweet is the response. To execute, just await the method call.
PCL support was essential too. PCL allows you to write code in a single assembly and target multiple platforms. In the case of LINQ to Twitter, I’m targeting .NET 4.5, Windows Phone 8, Windows Store (WinRT/Win8), Windows Azure, Xamarin.Android, and Xamarin.iOS. This allows you to use LINQ to Twitter in cross-platform scenarios. My recent post, Watch LINQ to Twitter on Glass, demonstrates the power of portability by showing how to write an app for Google Glass with LINQ to Twitter.
Available via NuGet
The assembly is named LinqToTwitterPcl.dll, containing code that is common for all platforms. There are also platform specific assemblies to support types, like authorizers, that are not cross-platform: LinqToTwitter.AspNet for ASP.NET and LinqToTwitter.WindowsStore for Windows Store apps. Additionally, LINQ to Twitter now has dependencies on HttpClient, which is a Microsoft library supporting async HTTP communication and is available via NuGet. If you download the NuGet package, all of the appropriate references are added to your project automatically.
For more help, all of the Documentation on the LINQ to Twitter Web site is updated. Samples are available and are distinguished (from older v2.1.x) by the Linq2Twitter_ prefix in the downloadable Source code.