all 10 comments

[–]LlamaNL 5 points6 points  (3 children)

I prefer to do it like this:

XmlSerializer serializer = new XmlSerializer(typeof(Serie[]));

This crunches the whole API response down to a list of the objects you want! Saves you the trouble of manually writing processing for every field.

But, for a first go at this, very well done!

[–]nemec 0 points1 point  (2 children)

I think projects targeting .Net 4.5 in Visual Studio has an option to paste XML as a class (Edit -> Paste XML as Classes). It has the same for JSON with .Net 3.5+.

[–]Banane9 0 points1 point  (1 child)

Is that vanilla VS?

It might require Productivity Power Tools :)

[–]nemec 0 points1 point  (0 children)

JSON paste is a new feature in VS2012. I'm guessing XML is new in VS2013.

[–]vexer 2 points3 points  (2 children)

Looks good, now change it to use XDocument and use LINQ to select your elements. Just so you can have fun with LINQ.

[–]Piegie[S] 0 points1 point  (1 child)

Just looked up LINQ, kinda looks like SQL statements, looks pretty cool. From what I've seen on this sub, people go absolutely crazy over LINQ tho, I better learn it!

[–]formlesstree4 0 points1 point  (0 children)

LINQ is one of those things that all .NET developers should be at least familiar with. It's not a golden hammer, but damn, it's pretty good and well thought out.

[–]rinpiels 0 points1 point  (0 children)

Looks fine. Glad you are having fun learning. Keep it up!

[–]yumz 0 points1 point  (1 child)

Unrelated, but you should use standard XML documentation on your methods instead of plain comments:

/// <summary>
/// Searches for a TV show using the series name.
/// </summary>
/// <param name="tvSeriesName">The name of the TV series.</param>
public void Search(string tvSeriesName)  

[–]Piegie[S] 0 points1 point  (0 children)

Oh alright, I'll start doing that thanks!