In other languages I used this pattern to keep tabs on all the instances of my class within the class itself, just take a ref to the instance within the constructor and push it onto a static array.
When I try creating an instance of this bogus lil class I get the "Object reference not set to an instance of the object" on the records.add(Me) line.
I need a clue... Is this just not a fit for VB .NET coding style? I have a couple C# books, its kinda hard to find a nefarious question like this in their index or by flippin through. Thanks!
When I try creating an instance of this bogus lil class I get the "Object reference not set to an instance of the object" on the records.add(Me) line.
I need a clue... Is this just not a fit for VB .NET coding style? I have a couple C# books, its kinda hard to find a nefarious question like this in their index or by flippin through. Thanks!
VB.NET:
Public Class Record
Public Shared records As List(Of Record)
Dim _artist As String
Dim _album As String
Public Sub New()
records.Add(Me)
End Sub
End Class