Null Dereference

Null Deference findings are most often associated with FOR EACH loops. This finding can be dropped by rewriting the loop as a simple FOR loop.

For instance, this code:

Dim MyList As New List(Of String)
For Each Item As String In MyList
     Item = Item & ": LOOPED!,"
Next

could be rewritten like this to drop the Null Dereference finding:

Dim MyList As New List(Of String)
For StringIndex As Integer = 0 To MyList.Count - 1 Step 1
     MyList(StringIndex) = MyList(StringIndex) & ": LOOPED!,"
Next

Built with HTML5 and CSS3
Copyright © 2014 Sitepearl