Boolean Extensions
Extensions to boolean data types.
ToYesNo
Converts boolean value to either "yes" or "No".
string ToYesNo(this bool source);Example:
bool result = true;
string resultInString = result.ToYesNo();
ToYesNo
Converts boolean value to either "yes" or "No".
string ToYesNo(this bool source, string pattern);Example:
bool result = true;
string resultInString = result.ToYesNo("Ja|Nein");
DoOn
Executes an action while the given boolean value is equal to target value.
void DoOn(this bool source, bool result, Action execute);Example:
bool operationResult = ...;
operationResult.DoOn(true, ()=>{
// code goes here
});