I am looking at code that is essentially passing an id around, for example:
GetPersonById(int personId)
But instead of using an int, it used a PersonId object.
GetPersonById(PersonId personId)
The PersonId object is just an int with some hand-cranked code to make it nullable. So was this created in old .NET when nullable ints weren't available or is there a higher purpose for wrapping simple types in a class?
public sealed class PersonId {
private PersonId() {
_isNull = true;
_value = 0;
}
private PersonId(int value) {
_isNull = false;
_value = value;
}
// and so on!
}