An Optional can also be constructed from a value. It is possible to assign a value to an Optional, and to reset an Optional to contain a Null value by calling clear().

For use with Optional, the value type should support default construction.

Note that the Optional class is basically the same as Nullable. However, serializers may treat Nullable and Optional differently. An example is XML serialization based on XML Schema, where Optional would be used for an element with minOccurs == 0, whereas Nullable would be used on an element with nillable == true.