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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:31:37+00:00 2026-05-27T00:31:37+00:00

I was just tidying up some code when I found this region in the

  • 0

I was just tidying up some code when I found this region in the class:

    #region IDisposable Members

        void IDisposable.Dispose()
        {
        } 

     #endregion

Now understand that this is implementing the Dispose method for the IDisposable interface and I know that the class declaration says that this class will implement the IDisposable interface.

What I don’t get is why it reads:

void IDisposable.Dispose()

And not:

public void Dispose()

I guess that the IDisposable.Dispose indicated explicitly that this is the Dispose that implements the IDisposable interface? Is this correct and what’s the advantage of doing this?

  • 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-27T00:31:38+00:00Added an answer on May 27, 2026 at 12:31 am

    It is an explicit interface implementation.

    It means that only a variable of type IDisposable can call Dispose on this class.

    Doing so “hides” the Dispose method when used with a variable of the class type – it will not be able to call it directly without first casting to IDisposable. It is possible that the implementer did this on purpose.

    Additionally, if the class were to implement its own Dispose (or inherit/implement from a class/interface that also defines a Dispose method), this will allow multiple implementations to exist.

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

Sidebar

Related Questions

Just found this out, so i am answering my own question :) Use a
just like: <div class=wrapper>some html text</div> just don't know why we need it.
Just had a question regarding the UILabel class. I know that the UITextField control
Just wondering if anyone can help me with this slight issue. I'm writing a
Working on a project, nearly finished and just tidying up the HTML and I
Just a quick question on the iphone technology within this business card reader http://www.youtube.com/watch?v=F8z6pcxdrPo
Just asking for some recommendations. I looking for good hosting alternatives for a GWT
Just moving over to Vim at the moment. In TextMate I could format code
Just when I thought I've understood this topic completely, I'm back to basics. I
Just a stupid question. Provide a code snippet b=a=2 How to extract the value

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.