Reputation: 1618
I think !
is a very small sign to make the condition having negative meaning. Can I use some alternative for that or create my own keyword (I would like to use not
, but if it is reserved keyword anything is ok.).
Upvotes: 1
Views: 164
Reputation: 9900
I don`t think it would be a good approach but i can suggest adding extension method to bool type. It would look like this
public static class BoolExtentions
{
public static bool Not(this bool self)
{
return !self;
}
}
Upvotes: 0
Reputation: 30481
Use !
. Its the conventional and simplest way to perform logical negation in C#.
You could obviously do whatever you like for yourself, but:
other libraries/code still use !
if some other people run across your code they will get confused (and probably still use !
when editing your code).
Upvotes: 5