Skip to main content

Posts

Showing posts with the label post

C# 2.0 - Nullable Types

It's 3 am and i don't feel like sleeping. I've been helping a friend to work on his code and now i'm only partially tired. Well, why not continue with my series on the evolution of C#? Let's do it! So, this time i'm going to talk about nullable types . Everybody used them already, but back in .Net 1.0 they didn't exist. How did you represent a "no value present" value? Sure, string can have null, but null is different than empty, right? How do you represent an empty numeric type then? You check if it is bigger than 0? Well for some cases that's just how developers did it. Either that or create a constant value that represents a "no value". But, to me, that is not expressive enough . Basically, a nullable type is only a non-nullable type wrapped in the System.Nullable struct. This is a generic struct, so it makes use of the Generic features of C# 2.0. The struct is very simple, it contains only a HasValue and a Value proper...

Introduction

Introduction My name is Mário Constantino, i'm Portuguese and i love what i do. I work as a junior developer at a small company for 2 years-ish now. This is where i started my career, so i'm still young and have the enthusiasm that comes with the age :) Our primary area is the development of ERP software in .NET technologies interacting with SQL. This gives me a little experience, but i'm far from an expert in the area, although i'm learning a lot each day. Blogging is a new experience for me, so you'll excuse me if i make some rookie mistakes. I've been on the internet since i can remember, but only on the consumer side, never on the producer. Well, for what it's worth, now i'm going to start to produce blog posts! But first, English is not my primary language, and some typos are in order. If you catch one, please tell me in a comment. I'm Portuguese, but i thought that by making the posts in English i would get a broader audience. Also, the...