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

The Archive Base Latest Questions

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

In an interview a while ago for a .NET position the interviewer asked me

  • 0

In an interview a while ago for a .NET position the interviewer asked me ‘what would you use a private interface for?’.

I asked him did he mean the difference between implicit vs explicit interface implementation to which he answered no.

So I’m wondering:

  1. What he meant?
  2. What you would use a private interface for?
  • 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. 2026-05-11T15:12:23+00:00Added an answer on May 11, 2026 at 3:12 pm

    An interface could be private within another class

    public class MyClass {     private interface IFoo     {         int MyProp { get; }     }      private class Foo : IFoo     {         public int MyProp { get; set; }     }      public static void Main(string[] args)     {         IFoo foo = new Foo();         return foo.MyProp;     } } 

    in terms of utility it simply hides from other code, even within the same assembly, that said interface exists. The utility of this is not terribly high in my opinion.

    Explicit interface implementation is a different matter, has some very useful cases (especially when working with generics and older non generic interfaces) but I would not term it ‘private interfaces’ and would not say that the term is commonly used in that manner.

    Using the two techniques together you can do:

    public class MyClass {     private interface IFoo     {         int MyProp { get; }     }      public class Foo : IFoo     {         int IFoo.MyProp { get; set; }     }      public static void Main(string[] args)     {         IFoo foo = new Foo();         return foo.MyProp;     } }  public class HiddenFromMe {     public static void Main(string[] args)     {         MyClass.Foo foo = new MyClass.Foo();         return foo.MyProp; // fails to compile     } } 

    This allows you to expose the nested classes in some fashion while allowing the parent class to invoke methods on them that the outside world cannot. This is a potentially useful case but is not something I would wish to use very often. Certainly it’s use in an interview smacks of being a boundary case the interviewer is using because they’ve seen it and though it was ‘interesting’

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

Sidebar

Related Questions

My friend was asked a question in his interview: The interviewer gave him an
In an interview for a SQL DBA position a while back, I mentioned I
I had telephone interview question yesterday. The interviewer asked me if I had faced
In a past interview, I was asked how would I write a mission critical
Had the following as an interview question a while ago and choked so bad
I came across this problem while preparing for an interview and curious to know
I have a job interview tomorrow for a .NET shop. For the past few
I was at an interview for a C position in which they presented me
I was asked this question during an interview. They're both O(nlogn) and yet most
I had an interesting job interview experience a while back. The question started really

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.