Ramblings & Controls from a .NET Addicted Freak!

Kevin Gearing's Blog

Shared Variables - Object Reference Not Set to an Instance of an Object

Can someone please explain why this throws an exception?

What's even stranger, is that in one class where I do something similar to this four times, three work fine, but the other one throws an exception...

Partial Class Strangeness

Inherits System.Web.UI.Page

Private _alphaCharacters() As String = MyDefaults.AlphaCharacters

Public ReadOnly Property AlphaCharacters() As String()


Return _alphaCharacters

End Get

End Property

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

End Sub

End Class

Class MyDefaults

Public Shared ReadOnly AlphaCharacters() As String = MyDefaults.DefaultAlphaCharacters
Public Shared ReadOnly DefaultAlphaCharacters() As String = {"A", "B"}

End Class


No Comments
Copyright ©2004-2007 Kevin Gearing. All Rights Reserved.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems