ExtensionMethod.NET Home of 880 C#, Visual Basic, F# and Javascript extension methods

toggle for bool

Toggle to bool

Source

public static bool toggle(this bool value)
{
     return !value;
}

Example

bool variavel = true;
variavel = variavel.toggle(); // false

Author: Luã Govinda

Submitted on: 11 jun. 2015

Language: C#

Type: C#

Views: 5385