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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:12:10+00:00 2026-05-23T05:12:10+00:00

Okay, I have two namespaces. One contains my interface and one contains the implementing

  • 0

Okay, I have two namespaces. One contains my interface and one contains the implementing class. Like this:

namespace Project.DataAccess.Interfaces
{
    public interface IAccount
    {
        string SomeMethod();
    }
}

namespace Project.DataAccess.Concrete
{
    class Account : Project.DataAccess.Interfaces.IAccount
    {
        string SomeMethod()
        {
            return "Test";
        }
    }
}

With this code I get an error:

‘Project.DataAccess.Concrete.Account’ does not implement interface member ‘Project.DataAccess.Interfaces.IAccount.SomeMethod’. ‘Project.DataAccess.Concrete.Account.SomeMethod’ cannot implement an interface member because it is not public

If I make the class and method public it works fine. But if I instead qualify the method name with the interface name, that fixes it too. Why? Ex:

namespace Project.DataAccess.Concrete
{
    class Account : Project.DataAccess.Interfaces.IAccount
    {
        string IAccount.SomeMethod()
        {
            return "Test";
        }
    }
}

Why does this fix it? And why does it have to be public if I don’t do that?

To be clear

I am well aware that making it public fixes it. Making the method signature look like this WITHOUT making anything public fixes it:

string IAccount.SomeMethod()

Why?

  • 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-23T05:12:11+00:00Added an answer on May 23, 2026 at 5:12 am

    Interface implementations need to be public or explicit:

    Public:

    class Account : IAccount
    {
        public string SomeMethod()
        {
            return "Test";
        }
    }
    

    Explicit:

    class Account : IAccount
    {
        string IAccount.SomeMethod()
        {
            return "Test";
        }
    }
    

    The default access modifier in C# is private if you do not specify the access modifier.

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

Sidebar

Related Questions

Okay, I have two OperationContracts and MessageContracts, like this: [OperationContract] OperationResult OperationOnSingleItem(Input input) [OperationContract]
Imagine I have two class A and B defined like this : class A
I have a class library project which uses a namespace (e.g., Cosmos.Creator.Util). I then
okay so I have two projects one in which I have done all the
I have two packages client and server: the client package contains an interface I_object:
Objective-C has no namespaces; it's much like C, everything is within one global namespace.
I have two projects in one solution : Class Library for my BLL and
Okay so I have two import pieces of code involved in this. This first
I have two tables: one table (okay, it's a view), vComputer, lists many computers
Okay, hopefully this is quick and easy. I have two separate java projects, 'Library'

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.