Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The logical negation operator (!) is a unary operator that negates its operand. It is defined for bool and returns true if and only if its operand is false.
Remarks
User-defined types can overload the ! operator (see operator).
Example
// cs_operator_negation.cs
using System;
class MainClass
{
static void Main()
{
Console.WriteLine(!true);
Console.WriteLine(!false);
}
}
Output
False True