Pastebin + C# PCL – put long texts or source on the web
Our team developed a easy 1-call api wrapper to put some texts or notes on Pastebin.com using their API.
How to use Pastebin API in C#?
To start using the wrapper, install nuget DT.PastebinApi by running the following command in Package Manager Console
PM > Install-Package DT.PastebinApi
The package is written as Portable Class Library, so you can use it in any of your projects.
The usage is fairly simple:
Uri noteUri = await DT.Pastebin.PastebinApi.NewPaste("your-developer-key", "note contents here");
You can get Pastebin developer API key on this page, don’t forget to log in.
There are other overloads of this method where you can configure paste title, format (text, c#, html and so on),access rule and expiration details.
In then end we’d like to add that now we have HttpClient API available as Portable Class Library available, it’s easy to create portable (PCL) libraries that contain API wrappers for almost any service and then use these libraries on .NET 4.5, Silverlight 4+, Windows Phone 7.5+ and apps for Windows Store. You can also use gzip support and json serialization in PCL.
If you’re interested in Portable Class Library, make sure you read this Scott’s article: http://www.hanselman.com/blog/CrossPlatformPortableClassLibrariesWithNETAreHappening.aspx
Have a good day!