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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:01:14+00:00 2026-05-30T23:01:14+00:00

I have following interface That I am implementing interface IReport <TOutput> { List<TOutput> GenerateReport<TInput>(TInput

  • 0

I have following interface That I am implementing

    interface IReport <TOutput>
    {
        List<TOutput> GenerateReport<TInput>(TInput input);
    }

In my implementation of this function

I want the output be FeederPerformanceErrorEntry type and input type be Tuple<int, int, bool>

What I am doing wrong ?

public List<FeederPerformanceErrorEntry> GenerateReport< FeederPerformanceErrorEntry , Tuple<int, int, bool> >(Tuple<int, int, bool> tuple)

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-30T23:01:15+00:00Added an answer on May 30, 2026 at 11:01 pm

    That’s not how generic methods work. If you have a generic interface, you can say that your class that implements that interface is not generic and has some specific type parameters.

    But you can’t do the same for generic methods. Those always have to work for any type (or any type that satisfies specified constraints, if you have them). Although “work” here may mean “throw an exception”.

    So, you could implement that method like this:

    public List<FeederPerformanceErrorEntry> GenerateReport<TInput>(TInput input)
    {
        if ((typeof(TInput) != typeof(Tuple<int, int, bool>))
            throw new InvalidOperationException();
    
        // rest of your code here
    }
    

    But if you want to do that, you don’t actually need generic method. It would be better if you changed the interface (if you can) to:

    interface IReport<TInput, TOutput>
    {
        List<TOutput> GenerateReport(TInput input);
    }
    

    And then implement the class as:

    class FeederReport : IReport<Tuple<int, int, bool>, FeederPerformanceErrorEntry>
    {
        public List<FeederPerformanceErrorEntry> GenerateReport(Tuple<int, int, bool> input)
        {
            // your code here
        }
    }
    

    If you are able to create the report from several different input types, you can always implement the interface several times:

    class FeederReport : IReport<Tuple<int, int, bool>, FeederPerformanceErrorEntry>,
                         IReport<Feeder, FeederPerformanceErrorEntry>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have the following interface that I want to share between my server
I have the following VB.net interface that I need to port to C#. C#
I have a third-party (Win32) DLL, written in C, that exposes the following interface:
I have something that looks like the following: [CoolnessFactor] interface IThing {} class Tester
Let's say I have the following Java interface that I may not modify: public
I have written my own java.util.List implementation, and now i want to store it
I am working with a COM plugin interface that has the following function definition:
Say I have the following interface: ICarProvider And the following classes implementing it: RedCarProvider:ICarProvider
I have a generic PostProcessor interface that looks like this: public interface PostProcessor<T> {
I am implementing INotifyPropertyChanged and as part of that interface I have the member

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.