Question: I have a class containing a number of properties, something like:

```
public class Update
{
    public int Quantity { get; set; }
    public decimal Price { get; set; }
    public string Name { get; set; }
}

```

Each instance of `Update` does not necessarily have each property set, and another part of the system needs to know which have been set, and which haven't.

One option I've got is to make all the value types `Nullable` and so a `null` value would represent the concept of not being set. Whilst this would work, I don't really like the idea of having some properties explicitly `Nullable` (the value types) and some nullable by virtue of being a reference type. The class definition would look ugly and I'm not convinced a null check is semantically the best approach.

I could create a class very similar to `Nullable<T>` that has no constraint on the `T` with an `IsSet` property. I prefer this option to using `Nullable`, but I'd still like to see if anyone has an alternative representation that's better than the options I've suggested.

Answer: 
The reference types are *already* nullable, effectively - if you use `int?`, `decimal?` and `string` then every one of your properties can be null.

The problem comes if you ever want to set the `string` value to a null reference - if null is effectively a valid value which *is* set.

You certainly *could* write a `Maybe<T>` type, but I'm not sure I would - I would *probably* just use null... aside from anything else, it'll be more familiar for others reading the code who are used to C# idioms. For all the "anti-null" sentiment around (which I *do* share in many situations) there are cases where it's the simplest approach.
The solution here to

* use nullable wherever null is not a valid option
* use a default value wherever null is a valid option but you are perfectly sure that a given value won't occur
* use a boolean flag for each property where null is a valid value and you can't name a default which won't be used ever.

Examples:
Quantity should be nullable, because if it is set its value won't be null ever

Name should be defaulted to "" if Name might be null (the lack of a name) and you are sure Name will never be ""

A flag, let's say nameSet should be used if Name might have a null value and you can't think of a default value. This flag would be false by default and when you first set the value of Name, the flag should be set to true too.

If you want to handle all your properties in the same way a solution would be to create a class which would contain an Object and a boolean flag. The Object would store the value of the property and the flag would store whether the property was initialized, but I don't like this, because it creates a boolean flag even if it's not needed.