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 853395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:45:08+00:00 2026-05-15T07:45:08+00:00

Let’s say I have 2 interfaces defined like so: public interface ISkuItem { public

  • 0

Let’s say I have 2 interfaces defined like so:

public interface ISkuItem
{
    public string SKU { get; set; }
}

public interface ICartItem : ISkuItem
{
    public int Quantity { get; set; }
    public bool IsDiscountable { get; set; }
}

When I go to implement the interface in C#, VS produces the following templated code:

public class CartItem : ICartItem
{

    #region ICartItem Members

    public int Quantity { get {...} set {...} }

    public bool IsDiscountable { get {...} set {...} }

    #endregion

    #region ISkuItem Members

    public string SKU { get {...} set {...} }

    #endregion
}

In VB.NET, the same class is built out like so:

Public Class CartItem
    Implements ICartItem

    Public Property IsDiscountable As Boolean Implements ICartItem.IsDiscountable
        'GET SET'
    End Property

    Public Property Quantity As Integer Implements ICartItem.Quantity
        'GET SET'
    End Property

    Public Property SKU As String Implements ISkuItem.SKU
        'GET SET'
    End Property
End Class

VB.NET explicitly requires you to add Implements IInterfaceName.PropertyName after each property that gets implemented whereas C# simply uses regions to indicate which properties and methods belong to the interface.

Interestingly in VB.NET, on the SKU property, I can specify either Implements ISkuItem.SKU or Implements ICartItem.SKU. Although the template built by VS defaults to ISkuItem, I can also specify ICartItem if I want. Oddly, because C# only uses regions to block out inherited properties, it seems that I can’t explicitly specify the implementing interface of SKU in C# like I can in VB.NET.

My question is: Is there any importance behind being able to specify one interface or another to implement properties in VB.NET, and if so, is there a way to mimic this functionality in C#? Furthermore, what is the effect of specifying one interface over another when implementing properties?

  • 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-15T07:45:08+00:00Added an answer on May 15, 2026 at 7:45 am

    I think the other answers are actually a little off the mark here.

    In the example you’ve posted, one interface inherits from the other. This simply means that it offers the same members as its base, plus some additional members.

    These are not two independent interfaces that happen to expose members with the same name. ICartItem.SKU is the same thing as ISkuItem.SKU. That ICartItem inherits from ISkuItem simply means that ISkuItem, as an interface, represents a subset of the functionality offered by ICartItem.

    Consider this code:

    class CartItem : ICartItem
    {
        public int Quantity { get; set; }
        public bool IsDiscountable { get; set; }
    
        string ISkuItem.SKU
        {
            get { return "ISkuItem"; }
            set { throw new NotSupportedException(); }
        }
    
        string ICartItem.SKU
        {
            get { return "ICartItem"; }
            set { throw new NotSupportedException(); }
        }
    }
    

    This class will not compile. You cannot define ICartItem.SKU explicitly in this case, because ICartItem.SKU is just ISkuItem.SKU. There’s no “other” SKU property to define.

    So, to answer your questions directly:

    Is there any importance behind being
    able to specify one interface or
    another to implement properites in
    VB.NET?

    When they are separate, unrelated interfaces: yes.
    As others have pointed out, you can provide different implementations for different interfaces’ members sharing a common name.

    But when one interface inherits from the other: no.
    It doesn’t matter because they’re the same thing.

    What is the effect of specifying one
    interface over another when
    implementing properites?

    Again, if they’re unrelated interfaces, it has the effect already discussed by others: providing different implementations for the two interfaces. But if one derives from the other, it has no effect.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer There's a syntax error on the first line of your… May 15, 2026 at 1:33 pm
  • Editorial Team
    Editorial Team added an answer SQL profiler is another client of the database so it… May 15, 2026 at 1:33 pm
  • Editorial Team
    Editorial Team added an answer There's not really any way to do this. At least,… May 15, 2026 at 1:33 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.