Im not sure - but I think the following is nw supported

 

Public Readonly Test() as string

 

whit I think can also takea default value is this form

 

Public Readonly Test() as string  = "VALUE"

 

the value is set up in a variable wiht the same name as the property name 
prefixed wiht underscore:

_Test which takes the same type as the property.  I seem to remember that you 
can not declear this variable otherwise it breaks the compile and you have to 
set up the property the long way.  but you can use it.

 

As I say all this is from memory nubut I hope it is correct

 

Martyn


 
> Date: Fri, 16 Jul 2010 13:18:38 +1000
> Subject: Re: VB10 auto readonly properties?
> From: [email protected]
> To: [email protected]
> 
> Damn! Thanks Winston!
> 
> On Fri, Jul 16, 2010 at 11:55 AM, Winston Pang <[email protected]> wrote:
> > Also, backing connect report:
> >
> > https://connect.microsoft.com/VisualStudio/feedback/details/457176/readonly-auto-implemented-properties
> >
> >
> > On Fri, Jul 16, 2010 at 11:53 AM, Winston Pang <[email protected]>
> > wrote:
> >>
> >> Don't think it's supported, has to be the long way, i.e.
> >>
> >>     ReadOnly Property Test As String
> >>         Get
> >>
> >>         End Get
> >>     End Property
> >>
> >> ReadOnly Property
> >>
> >> On Fri, Jul 16, 2010 at 11:40 AM, Bec Carter <[email protected]>
> >> wrote:
> >>>
> >>> In C# I can do this
> >>>
> >>> public string MyProperty { get; private set; }
> >>>
> >>> What is the VB10 equivalent? Hopefully not the long way :(
> >>
> >
> >
                                          
_________________________________________________________________
http://clk.atdmt.com/UKM/go/197222280/direct/01/
We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now

Reply via email to