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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:20:53+00:00 2026-05-24T13:20:53+00:00

I have 2 C# interfaces like this: public interface IEvernoteJobListener { void CopyS3File(S3Location src,

  • 0

I have 2 C# interfaces like this:

public interface IEvernoteJobListener
{
    void CopyS3File(S3Location src, EvernoteLocation des, Action<Exception> complete);
}

public interface ICopyJobListener
{
    void CopyS3File(S3Location src, S3Location des, Action<Exception> complete);
}

You can see that they are almost identical besides their second parameter, which makes the implementation nearly identical. What stops me from merge them into a single interface is that EvernoteLocation and S3Location are structs, so I can’t make them inherit from the same parent and thus eliminate the difference between them and only keep one interface and one method.

What are the possible solutions to eliminate the duplication of the interface?

Edit:

The code of implementation might help clarify the question:

    public void CopyS3File (S3Location src, EvernoteLocation des, Action<Exception> complete)
    {
        reader.ReadS3ToFile(src, (file, readExc) => {
            if(readExc != null)
            {
                complete(readExc);
                return;
            }

           // This is a Evernote writer.
            writer.WriteFromFile(file, des, writeExc => {
                complete(writeExc);
            });
        });
    }


    public void CopyS3File (S3Location src, S3Location des, Action<Exception> complete)
    {
        reader.ReadS3ToFile(src, (file, readExc) => {
            if(readExc != null)
            {
                complete(readExc);
                return;
            }

               // This is a S3 writer.
            writer.WriteFromFile(file, des, writeExc => {
                complete(writeExc);
            });
        });
    }
  • 1 1 Answer
  • 1 View
  • 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-24T13:20:54+00:00Added an answer on May 24, 2026 at 1:20 pm

    You could make the interface generic.

    public interface IJobListener<TDes>
    {
        void CopyS3File(S3Location src, TDes des, Action<Exception> complete);
    }
    

    But I don’t know how that helps with your implementation.

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

Sidebar

Related Questions

I have an interface like this: public interface IUser{ //some properties here T ToDerived(User
I have an interface and a class implementing the interface like this: public interface
I have an Interface like this: namespace QuickRoutes.Model.Utilities { public interface IRoutesManager { bool
I have a proxied method in a MongoRepository extender class like this: public interface
I have a model that looks like this: public interface IEntity { int Id
Say, I have three interfaces: public interface I1 { void XYZ(); } public interface
Let's say I have 2 interfaces defined like so: public interface ISkuItem { public
What is the difference of using interfaces like ... I have an interface Public
I have this two interfaces and classes: public interface Identifiable<T> { T getId(); }
Simple case: I have an interface for logging messages, like this: public interface ILogger

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.