This project has moved and is read-only. For the latest updates, please go here.

System.Boolean extension methods

IfTrue(Action)

Summary: This method executes the specified Action if the Boolean value is True

C# Example:
var value = true;
value.IfTrue(() => {
    // do something
    // only called when value == true
});

IfFalse(Action)

Summary: This method executes the specified Action if the Boolean value is False

C# Example:
var value = false;
value.IfFalse(() => {
    // do something
    // only called when value == false
});

ToBinary()

Summary: Returns a binary (or "bit") representation of the Boolean value. True returns 1; False returns 0
C# Example:
var b = true;
var binaryValue = b.ToBinary();

Last edited May 4, 2012 at 3:14 PM by crpietschmann, version 5

Comments

No comments yet.