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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:29:04+00:00 2026-06-17T03:29:04+00:00

I will give an example from .NET. ConcurrentDictionary<TKey, TValue> : IDictionary<TKey, TValue>, IDictionary Here

  • 0

I will give an example from .NET.

ConcurrentDictionary<TKey, TValue> : IDictionary<TKey, TValue>, IDictionary

Here you can see ConcurrentDictionary implementing dictionary interfaces. However I can’t access Add<TKey,TValue> method from a ConcurrentDictionary instance. How is this possible?

IDictionary<int, int> dictionary = new ConcurrentDictionary<int, int>();
dictionary.Add(3, 3); //no errors

ConcurrentDictionary<int, int> concurrentDictionary = new ConcurrentDictionary<int, int>();
concurrentDictionary.Add(3, 3); //Cannot access private method here

Update:

I know how I can access it but I didn’t know explicitly implementing an interface could allow changing access modifiers to internal. It still doesn’t allow making it private though. Is this correct? A more detailed explanation about that part would be helpful. Also I would like to know some valid use cases please.

  • 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-06-17T03:29:05+00:00Added an answer on June 17, 2026 at 3:29 am

    It is implemented as an explicit interface implementation, meaning you need a variable of the IDictionary<TKey, TValue> type to access it.

    See the documentation of ConcurrentDictionary<TKey, TValue>, under the Explicit Interface Implementations section.

    If you cast the concurrent dictionary to IDictionary<TKey, TValue>, you will be able to call Add on it.


    I didn’t know explicitly implementing an interface could allow changing access modifiers to internal. It still doesn’t allow making it private though. Is this correct?

    No, this is not correct.

    Explicit interface implementations do not change the access modifiers. They change how you can access the members that were implemented that way (i.e. require you to use a variable of the interface type). They are still public members, but can only be accessed using the interface type, not the implementing type.

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

Sidebar

Related Questions

I need a regex that will give me the following results from each example
From php.net: <html> <?php /* This will give an error. Note the output *
i will give an example of the problem i have. My XML is like
My question is maybe a bit unclear so i will give an example <table
After using grep command, i will give you a small example grep test test
Hope someone will give me a hand with this problem I have. So here
AssemblyName.GetAssemblyName().Version.ToString() will give the version number ,,but i need to get version number from
Can someone give me an example of how I can create an exe file
Here is a live example of my problem http://jsfiddle.net/littlesandra88/xksB9/ I would have expected that
Can anybody give an example of drill down functionality for column charts of Highcharts

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.