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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:39:12+00:00 2026-05-31T15:39:12+00:00

I keep seeing List derived classes that look something like this class MyClassList :

  • 0

I keep seeing List derived classes that look something like this

class MyClassList : List<MyClass>
{
    public MyClass this[int index]
    {
        get { return (MyClass)base[index]; }
    }
}

What is the point of this inheritance? It looks like it just restates the casting of the member. I could understand other types of indexer, but this is just a restatement of the default List indexer, and provokes a Visual Studio warning RE: hiding of the base indexer. Is this the right or wrong thing to do, and why?

  • 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-31T15:39:13+00:00Added an answer on May 31, 2026 at 3:39 pm

    There is no good reason for this. It hides the base indexer instead of overriding it, which could be dangerous, and it doesn’t have any effect at all.

    In most cases, it’s best just to use a List<MyClass> directly. There’s no need to create a special class for this if you’re not planning to extend List<>‘s functionality at all.

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

Sidebar

Related Questions

I keep seeing code that does checks like this if (IsGood == false) {
I keep seeing this come up and every time I look it up I
I keep seeing documentation saying that its not possible to send to a remote
I'm trying to learn about this feature of javascript I keep seeing in code,
I keep seeing people using doubles in C#. I know I read somewhere that
I keep seeing variations of this: Not equal != Not equal, equal !== Which
Is it possible to use assert_equal to compare objects? I keep seeing this error:
I'm wondering if There is something that I can do to better get keep
I keep seeing people say that exceptions are slow, but I never see any
Using Visual Studio 2008, I keep seeing this error in the output window: _CrtDbgReport:

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.