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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:51:17+00:00 2026-05-25T05:51:17+00:00

The other day i was looking at C# Boolean struct metadata. Boolean implements the

  • 0

The other day i was looking at C# Boolean struct metadata.

Boolean implements the interface IConvertible. But looking at Boolean’s members i could not see most of the IConvertible members.

I’ve done some tests with some colleagues, including creating our own classes, and came to the conclusion that IConvertible must be implemented explicitly for Boolean.

The question is, why are they not visible? I understand it might be a ‘by design decision’ but i understand that it would add greater value if they were visible to anyone inspecting the metadata.

The tests were done in VS2010 .NET4.0

  • 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-25T05:51:17+00:00Added an answer on May 25, 2026 at 5:51 am

    The reason is that those methods are there just to implement the I-interface and not to augment the class’ public interface.

    What I mean is that if you have the following:

    public class MyClass : IConvertible
    {
     // implementation
    }
    

    You might want MyClass to be convertible, indeed, so you can pass references of it to methods that expect IConvertible:

    public void DoSomethingWithConvertible(IConvertible conv)
    

    But you might not want variables of type MyClass to expose the Convert methods. You simply don’t want MyClass’s public interface to have that method, then you implement the interface explicitly. That’s the whole idea of the approach. This means the following is not allowed:

    MyClass a = new MyClass();
    a.Convert();
    

    However, the following is still be allowed:

    MyClass a = new MyClass();
    ((IConvertible)a).Convert();
    

    The whole idea behind this is that even though we’re using the exact same instance, a as MyClass doesn’t have the method. A as IConvertible does have the method. Think of it as if you’re allowing the instance to have split personality.

    Usually I end implementing every interface implicitly. However, there are very specific situations where I’d implementing them explicitly exactly for the reasons outlined above.

    BTW, thanks for the great question!

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

Sidebar

Related Questions

I saw this the other day (scroll all the way down to see some
I was looking over some code the other day and I came across: static
While looking for something totally different the other day, I have stumbled upon two
I was looking through some code in a string escape library the other day
Once before, I was certain that you couldn't do this, but the other day
I was looking at one of the job postings the other day and surprised
A friend of mine asked me the other day if I'm just looking at
The other day I was looking through our code and I came across a
The other day I was looking into Zend Server and I was wondering why
So the other day, I was looking through some old C++ books and noticed

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.