Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 391053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:01:27+00:00 2026-05-12T16:01:27+00:00

I have a class in vb.net like Public Class Customer Private _Name As String

  • 0

I have a class in vb.net like

Public Class Customer
    Private _Name As String
    Public Overridable Property Name() As String
        Get
            Return _Name
        End Get
        Set(ByVal value As String)
            _Name = value
        End Set
    End Property
End Class

and a class deriving from it

Public Class ProxyCustomer
    Inherits Customer
    Private _name As String
    Public Overrides WriteOnly Property Name() As String
        Set(ByVal value As String)
            _name = value
        End Set
    End Property
End Class

which gives me following error
Public Overrides WriteOnly Property Name() As String’ cannot override ‘Public Overridable Property Name() As String’ because they differ by ‘ReadOnly’ or ‘WriteOnly’

but i have same construct in C#

public  class Customer 
{
    public virtual string FirstName { get; set; }     
}

public class CustomerProxy:Customer
{

   public override string FirstName
   {
       set
       {
           base.FirstName = value;
       }
   }

}

which works, so the first thing is , is this consistent because 2 languages are behaving in a very inconsistent way.

secondly, when i do a reflection to get a property, so for example

Dim propInfo  = GetType(Customer).GetProperty("Name")

the propINfo.canRead property is always false, shouldn’t this be true since base class implements the getter of the property ?

many thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T16:01:28+00:00Added an answer on May 12, 2026 at 4:01 pm

    I’ll deal with the 2nd part first. In your current vb.net code, the derived Name property replaces the original for the reflection lookup. So that reflection code only see the WriteOnly version of the property. Worse, you completely replace the backing store in your derived setter, so your getter is checking a completely different variable than the one you set.

    As for the first question, when overriding properties in vb.net, you always need to override both the getter and the setter, even if you just replace it with an identical implementation:

    The code should read like this:

    Public Class ProxyCustomer
        Inherits Customer
    
        Public Overrides Property Name() As String
            Get
                Return MyBase.Name ''# Return the original parent property value
            End Get
            Set(ByVal value As String)
                MyBase.Name = value
            End Set
        End Property
    End Class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 368k
  • Answers 368k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You might try using Devel::SimpleTrace to get a stack trace… May 14, 2026 at 6:04 pm
  • Editorial Team
    Editorial Team added an answer An alternate approach is to use CTRL-Z to undo the… May 14, 2026 at 6:04 pm
  • Editorial Team
    Editorial Team added an answer RegisterHotKey in the Windows API will allow you to register… May 14, 2026 at 6:04 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.