April 2008 - Posts

29 April 2008
LINQ To XML: building documents with a functional approach
In the previous post I've talked about some of the classes you'll find in this new API. Today we'll see how easy it is to create a new XML document with the new API. Most of the time, you'll end up working with the XElement or XAttribute classes. Lets start with an existing XML tree:... Read More...
Filed under:
28 April 2008
LINQ To XML: I'm hooked!
I've just started doing some LINQ To XML and I can assure you that the new API is really great! Just take a look at the new Object Model introduced by the System.XML.Linq assembly: Today I'll just cover the basics (really a quick presentation of the most important elements you can find in the... Read More...
Filed under:
26 April 2008
C# and Nullable value types
.NET 2.0 introduced Nullable value types. As you surely know by now, you cannot set a value type to null. Here's an example: Int32 myVar = null; //error: myVar cannot be set to null This can be easily solved by transforming myVar into a Nullable type: Nullable<Int32> myVar = null; If you prefer... Read More...
Filed under:
26 April 2008
Type inference in C# 3.0
My friend Paulo published a post that talks about type inference and how it might evolve in the next years. Even though type inference's main objective is to support LINQ (in fact, most of the new stuff that C#3.0 introduced is only there to support LINQ), I must say that I've been enjoying it... Read More...
Filed under: ,
16 April 2008
C# Gotchas
[Update: Thanks to Mike for uncovering a bug on the sample. It should be IDummy.Increment and not Dumy.Increment . Thanks Mike and now I think it should compile without any problems.] In these last days I've been reading the C# spec and you can say that I've been re-discovering it :) If you really... Read More...