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

  • SEARCH
  • Home
  • 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 7035245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:16:54+00:00 2026-05-28T01:16:54+00:00

How can I convert following code to VB.NET? class A { public int NumberA

  • 0

How can I convert following code to VB.NET?

class A
{
    public int NumberA { get; set; }
}

class B : A, I
{
    public int NumberB { get; set; }
}

interface I
{
    int NumberA { get; set; }
    int NumberB { get; set; }
}

In VB.NET there is problem with Implements keyword after property declaration. So I need to do something like this:

Class B
    Inherits A
    Implements IC

    Public Property NumberB() As Integer Implements IC.NumberB
    Get
        Return m_NumberB
    End Get
    Set(ByVal value As Integer)
        m_NumberB = value
    End Set
    End Property
    Private m_NumberB As Integer

    Public Property NumberA1() As Integer Implements IC.NumberA
    Get
        Return MyBase.NumberA
    End Get
    Set(ByVal value As Integer)
        MyBase.NumberA = value
    End Set
    End Property
End Class

But there is duplicit misleading property NumberA1. Is there some way how to do it more clever?

  • 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-28T01:16:54+00:00Added an answer on May 28, 2026 at 1:16 am

    Yes, not supported in vb.net. The compiler requires the interface to be implemented with an explicit Implements keyword, unlike C#. The closest you could get is:

    Interface ICA
        Property NumberA() As Integer
    End Interface
    Interface ICB
        Property NumberB() As Integer
    End Interface
    
    Class A
        Implements ICA
        Public Property NumberA() As Integer Implements ICA.NumberA
            '' etc
        End Property
    End Class
    
    Class B
        Inherits A
        Implements ICA, ICB
    
        Public Property NumberB() As Integer Implements ICB.NumberB
            '' etc...
        End Property
    End Class
    

    Note that B now no longer needs to implement NumberA even though it implements ICA, the implementation in A is accepted. But of course that requires way too much tinkering with the original definitions. The workaround you used is good and has no detrimental effects at runtime. Note that you can make A1 private.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Observe the following .NET type: public class X { public DateTime Timestamp {get;set;} public
I have the following code: public interface IMyInterface { DataGrid ItemsInGrid { get; set;
Is there some tool that can automatically convert the following c style code A
How i can convert to c# code files to html files?Is there any generation
I am trying to convert the following code for the variance calculation public static
I want to convert some VB.NET code for regular expression to F#. The following
I'm trying to convert the following code from C# to Java, but I get
I'm trying to convert some C# code to VB.NET. I have the following in
How can I convert the following struct to unsigned char* ? typedef struct {
How can you convert the following command for Ubuntu's ZSH? DavidPashley 's command for

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.