in

dotNetFreak

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()

Get

Return _alphaCharacters

End Get

End Property


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

End Sub


End Class


Public
Class MyDefaults


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

End Class

Comments

No Comments

Leave a Comment

(required)  
(optional)
(required)  

Protected by FormShield
Refresh
Listen
Please enter the characters shown on the image


Code:


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