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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 88k
  • Answers 88k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer "the simplest PHP framework" does not tell us at all… May 11, 2026 at 5:41 pm
  • Editorial Team
    Editorial Team added an answer You could consider using the Google Web Toolkit, GWT, to… May 11, 2026 at 5:41 pm
  • Editorial Team
    Editorial Team added an answer General approach for this kind of thing: For each day… May 11, 2026 at 5:41 pm

Related Questions

In an interview for a SQL DBA position a while back, I mentioned I
I was at an interview for a C position in which they presented me
From an interview with Peldi Guilizzoni , the creator of Balsamiq --an Adobe AIR
This is an interview question. You need to design a stack which holds an
I came across this problem while preparing for an interview and curious to know

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.