tags:

views:

311

answers:

1

Visual Basic allows for properties with mixed access levels, for example

Public Property Name() as String
    Get

    End Get

    Friend Set(ByVal value As String)

    End Set
End Property

Is there a way to define a MustOverride property with mixed getter/setter access level?

+3  A: 

Hmm... you can in C# very easily:

public abstract string Foo { get; protected set; }

Unfortunately Reflector creates invalid VB when I decompile that...

EDIT: Having looked at a few bits of documentation, I suspect you can't do this :( The MustOverride documentation states:

Incomplete Declaration. When you specify MustOverride, you do not supply any additional lines of code for the property or procedure, not even the End Function, End Property, or End Sub statement.

That suggests to me that you can't specify the different access levels :(

Jon Skeet
This is correct. VB has no syntax support for a mustoverride and mixed accessibility modifiers.
JaredPar