miércoles, 7 de septiembre de 2011

C# DreamInCode API - NuGet Package Released

Hey there. Today I took a gander at my DreamInCode library I released for .NET and decided to merge it over to Github.

https://github.com/sergiotapia/DreamInCode.Net

The source code is very easy to follow and hopefully I managed to clean out a lot of the cruft and over engineering I managed to cram in the previous version.

This time it's simple, clean and barebones.



There's a NuGet Package!



http://nuget.org/List/Packages/DreamInCode.Net



Using it in Visual Studio 2010.



You just have to right click and select Manage NuGet Packages. Then search for DreamInCode and you'll find it.



Usage of the library is very straightforward.

[sourcecode language="csharp"]
/* The UserRepository class is what you'll use to fetch information from the API. */
UserRepository userRepository = new UserRepository();

/* You can search for users by giving the repository a numerical ID. */
var user = userRepository.FindUserById(335389);

/* Accessing the information is very easy and intuitive. */
Console.WriteLine(user.UserProfileId);
Console.WriteLine(user.Name);
Console.WriteLine(user.Rating);
Console.WriteLine(user.Reputation);
Console.WriteLine(user.JoinDate);
Console.WriteLine(user.PostCount);

/* Their friends are already loaded into the User object! */
foreach (var friend in user.Friends)
{
Console.WriteLine("{0} - {1}", friend.FriendId, friend.Name);
}

/* So are their visitors! */
foreach (var visitor in user.Visitors)
{
Console.WriteLine("{0} visited on: {1}", visitor.Name, visitor.TimeOfLastVisit);
}

Console.ReadKey(true);[/sourcecode]

Hopefully you guys use it and some more .NET applications for us Windows users. I smell a DIC messenger maybe?

Let me know what you think and if you want to contribute feel free to pull request me on Github.

No hay comentarios:

Publicar un comentario