9
ziul
8y

Nuleable boolean

Comments
  • 0
    dafag?? srsly. dafag???? how?
  • 3
    x => x.IsActive ?? false
  • 1
    There is a Boolean object in Java that's nullable as well. It extends off of the primitive. Use case would be if you were persisting a form that had a yes or no choice on it, you can use null on the Boolean object to indicate no choice yet. Anything tri-state.
  • 0
    I don't get it. Why is this a shock. You can define a nullable of Boolean.
  • 1
    @Nexion I think I would use an enum for that:

    enum : byte {
    No = 0
    Yes = 1
    Unselected = 2
    }

    They can be casted and persisted as well.
  • 0
    @ziul yeah, but there are instances when using the default class is easier. Enums are great, but the Boolean class still has its use cases.
Add Comment