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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:32:37+00:00 2026-05-25T20:32:37+00:00

I dont know if what I’d like to do is simply not possible: or

  • 0

I dont know if what I’d like to do is simply not possible: or I’m not thinking about it in the correct way.

I’m trying to construct a repository interface class which accepts a generic type and uses this as the basis for the return on most of its methods, ie:

public interface IRepository<T> {
    void Add(T source);
    T Find(int id);
}

This would then be inherited by an actual repository class, like so:

public class TestClientRepository : IRepository<ClientEmailAddress>, IRepository<ClientAccount> {

}

The idea is that within a ClientRepository, for example, I will want to perform operations against a few different object types (ClientAccount, ClientEmailAddress etc); but in the main the types of operations needed are all the same.

When I try to use the TestClientRepository (after implementing the Interfaces explicitly) I cannot see the multiple Find and Add methods.

Can anyone help?
Thanks.

  • 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-25T20:32:38+00:00Added an answer on May 25, 2026 at 8:32 pm

    Sure – all you’ve got to do is use it as the appropriate interface:

    TestClientRepository repo = new TestClientRepository();
    
    IRepository<ClientEmailAddress> addrRepo = repo;
    ClientEmailAddress address = addrRepo.Find(10);
    
    IRepository<ClientAccount> accountRepo = repo;
    ClientAccount accoutn = accountRepo.Find(5);
    

    Basically explicitly implemented interface methods can only be called on an expression of the interface type, not on the concrete type that implements the interface.

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

Sidebar

Related Questions

I dont know if what i am asking is possible or not. That is
I dont know whether it is possible or not,But here is my question: I
I dont know why this particular bit of code is simply not updating despite
I dont know much about php. That said, is it possible to update the
I dont know if what I am trying to do is even possible, and
I dont know if my sessions are too big. Is there a way to
i dont know if i should be asking this here (im now thinking maybe
I dont know if this has been answered but what i am trying to
I dont know if this possible But I have an ajax function in my
I dont know much about classes, but have a reasonable knowledge of PHP/MySQL. But

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.