WriteOnly Properties?

Microsoft says WriteOnly properties are not good... but i dont know another way to write this object without using a write only property and was wondering if someone could point me in a direction.... here is the object

Code Snippet

Imports System

Imports System.Web.UI

Namespace Framework.Web.Controls

PublicClass ScriptRef

Inherits WebControls.Literal

PrivateConst _scriptRefMarkupAsString ="<script src=""{0}"" type=""text/javascript""></script>"

PublicWriteOnlyProperty Src()AsString

Set(ByVal valueAsString)

Me.Text =String.Format(_scriptRefMarkup, value.Replace("~", System.Web.HttpContext.Current.Request.ApplicationPath))

EndSet

EndProperty

EndClass

EndNamespace

I could change it to a public property but how would i set the Me.Text from this control being a literal to the value specified in the set?

[2869 byte] By [Tryin2Bgood] at [2008-1-2]
# 1

Why not stick with the WriteOnly property? ... if it was that bad, it wouldn't be part of the language

If it makes you feel any better .... change it to method (albeit that is what it ends up as anyway), or add a private reader

Richard

DickDonny at 2007-9-13 > top of Msdn Tech,Visual Basic,Visual Basic Language...