This project is read-only.

C# - isnot operator


VB is planned to be getting support for TypeOf IsNot in the next release but the C# column has an N/A.

I don't think this is exactly true, as C# would surely benefit from adding an isnot operator. Obviously, the workaround is rather simple (negating the value of an is comparison), but it is ugly and makes code unnecessarily convoluted, especially the comparison is nested with a lot of other logic in an if clause.

Compare these examples:
if(!(c is Foo)) { ... }
if(c isnot Foo) { ... }
An isnot operator would make this sort of code far easier to read and reason about at a glance.


Suchiman wrote Apr 29, 2014 at 2:09 AM

This is not an issue, that rather belongs to the discussions here

MgSam wrote Apr 29, 2014 at 3:42 PM

@Suchiman For other projects on CodePlex, people typically use the issue tracker for a mix of bug reports and feature requests/suggestions. I know for TypeScript the number of votes in the tracker definitely influences the feature prioritization. If you guys want to run it differently for Roslyn you should post something about that so people know.

ADGreen wrote May 2, 2014 at 8:40 PM


You've raised a good point. We're reconsidering our position.



iLMaX wrote Jun 17, 2014 at 6:34 PM

I prefer ! is syntax, but definitely a needed feature.

sruppr wrote Jul 15, 2014 at 11:27 AM

I would also prefer !is instead of isnot, it would be more consistent with other operators

slide_o_mix wrote Nov 3, 2014 at 11:17 PM

"is" doesn't really follow the normal "operator" way anyway, as it's spelled out instead of using a symbol like ~ or # or something (I am not recommending those). So, I think "isnot" makes sense and follows the way people may expect it to work along side "is".