Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

false Operator (C# Reference)

Returns the bool value true to indicate false and returns false otherwise. This is useful for types that represent true, false, and null, neither true nor false, as used in databases.

Such types can be used for the controlling expression in if, do, while, and for statements and in conditional expressions.

If a type defines operator false, it must also define operator true.

A type cannot directly overload the conditional logical operators && and ||, but an equivalent effect can be achieved by overloading the regular logical operators and operators true and false.

For more information, see the following sections in the C# Language Specification:

  • 10.9.1 Unary operators

  • 7.11.2 User-defined conditional logical operators

  • 7.16 Boolean expressions

Community Additions

© 2015 Microsoft