# Not = or <> preferable in VB.NET

In VB, I believe the following are equivalent:

If Not x = y Then
...
End If


and

If x <> y Then
...
End If


Am I wrong? Is there some scenario in which they are not equivalent? If so, what is it? If not, is one preferred over the other? Why? In the latter, the <> operator is pretty foreign looking to me, as I am more used to the C# !=. I also end up forgetting if it is <> or >< all the time. The downside of the former seems to be that it reads like Yoda speaks.

-

Using Not x = y is like using !(x==y) in C# instead of just using x!=y.
Use <>. Lack of comfort with a language's syntax is a poor excuse for knowingly using it improperly.
FYI, <> is used in SQL. VB.Net isn't the only language that uses it.
Good point. I hadn't really thought about the example you gave but it makes perfect sense. I would never use !(x==y) in C#. –  jtheis Feb 14 '13 at 19:09
Interestingly, != seems to work in T-SQL as well. –  Jesse C. Slicer Feb 14 '13 at 19:19
@JesseC.Slicer: True, but != is not ansi compliant, so <> is preferable. –  Brian Feb 14 '13 at 21:21