NullableBool Structure

A class for boolean values with possibility to check whether the value was defined or not.

Namespace:  Aspose.Tasks
Assembly:  Aspose.Tasks (in Aspose.Tasks.dll) Version: 21.5
Syntax
public struct NullableBool : IEquatable<NullableBool>

The NullableBool type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleNullableBool(Boolean)
Initializes a new instance of the NullableBool struct with the specified boolean value.
Public methodCode exampleNullableBool(Boolean, Boolean)
Initializes a new instance of the NullableBool struct.
Properties
  NameDescription
Public propertyCode exampleIsDefined
Gets a value indicating whether the value was defined; otherwise, false.
Public propertyCode exampleValue
Gets or sets a value indicating whether current value is true or false.
Methods
  NameDescription
Public methodCode exampleEquals(Object)
Returns a flag indicating whether this instance is equal to the specified object.
(Overrides ValueTypeEquals(Object).)
Public methodCode exampleEquals(NullableBool)
Returns a flag indicating whether this instance is equal to the specified instance of the NullableBool class.
Public methodCode exampleGetHashCode
Returns a hash code value for the instance of the NullableBool class.
(Overrides ValueTypeGetHashCode.)
Public methodGetType (Inherited from Object.)
Public methodCode exampleToString
Returns a string that represents the current object.
(Overrides ValueTypeToString.)
Operators
  NameDescription
Public operatorStatic memberCode exampleEquality
Returns a value indicating whether this instance is equal to a specified object.
Public operatorStatic memberCode example(Boolean to NullableBool)
Implicitly converts boolean value to the NullableBool instance.
Public operatorStatic memberCode example(NullableBool to Boolean)
Implicitly returns a boolean value.
Public operatorStatic memberCode exampleInequality
Returns a value indicating whether this instance is not equal to a specified object.
Examples
Shows how to work with <see cref="NullableBool" /> class.
var project = new Project();

// lets check where the <see cref="Aspose.Tasks.NullableBool" /> class is used
// the main advantage of <see cref="Aspose.Tasks.NullableBool" /> that 
// one can set it as undefined through constructing
var actualsInSync = new NullableBool(false, false);
Console.WriteLine("'ActualsInSync' Value: " + actualsInSync.Value);
Console.WriteLine("'ActualsInSync' Is Defined: " + actualsInSync.IsDefined);

// ...
// use nullable bool instance
project.Set(Prj.ActualsInSync, actualsInSync);

// ...
var honorConstraints = new NullableBool(true);
Console.WriteLine("'HonorConstraints' ToString: " + honorConstraints.ToString());

// ...
// use nullable bool instance
project.Set(Prj.HonorConstraints, honorConstraints);

// ...
See Also