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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:42:37+00:00 2026-05-25T14:42:37+00:00

I have seen this , but I am wondering if it would be possible

  • 0

I have seen this, but I am wondering if it would be possible to force the override of a member not marked as virtual or abstract with a derived type (hence that should not break the base object functionalities).

I am referring in particular to overriding:

IDictionary<TKey, TValue> Dictionary { get; }

in

KeyedCollection<TKey, TValue> 

with another member type that implements IDictionary, to use another internal storage collection.

Is it possible at all to bypass the limitation?

Note that I would not like to use extensions for this (in my case it would not be helpful anyway).

  • 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-25T14:42:37+00:00Added an answer on May 25, 2026 at 2:42 pm

    No- in .net a method must be marked as explicitly virtual or abstract to override it.

    EDIT: Given the edits to the question, it sounds like you need to create a custom class that implements IDictionary<TKey, TValue> (which I think KeyedCollection does), then add another indexer that allows you to get objects by TKey. The indexer would look like this:

    TValue this[TKey key] { get { ... } }
    

    If you want, you can back virtually all of the IDictionary methods and properties by delegating to a private KeyedCollection<TKey, TValue> field, and for those you want to implement differently you’d be free to do so. The full class would be too long for an answer, otherwise I’d post it.

    This goes toward the good development practice Prefer Composition over Inheritance

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

Sidebar

Related Questions

I am not an expert in Git, but I have seen this done before
I have seen a few posts regarding this issue but not one specific to
I thought I have seen this somewhere but can't find it any more on
I have seen this talked about but never answered. Maybe it has and I'm
I have seen this '[A' in a progress bar module but I can't figure
I have seen several posts similar to this but none with a strait forward
I have seen this symbol/operator in a block of code: a+=1; But I cannot
I have seen this code documented in the tk docs, but I can't figure
you must have seen this piece of code somewhere else too,but obviously there's no
In Microsoft SQL Server: I have seen this question several times, but can't see

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.