Friday, January 28, 2005

Peek .NET 2005: The IsNot operator

When you think about the things that makes VB so applealing for a lot of programmers, one of the first things to come into your mind is the simplicity of it. So readability of your program is always an important factor when programming.
If i want to make sure a reference variable does not have a null reference the general syntax in VB.NET is to use the keyword 'Is' and 'Not' as in:
If Not x is Nothing Then

With the new IsNot keyword this becomes:
If x IsNot Nothing Then

So what are the advantages of the latter over the former? As far as i know nothing much except it looks more readable and more simple and keeps to the spirit of the VB language.

No comments: