© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•15mo ago•
104 replies
Neophyte

How to to dynamically provide T type of a generic method

I am having an interface declaration which has many-many implementations. The usecase/logic is similar, but the return type differs.
(tldr: the services parse and validate data extracted from different systems. They each return the parsed structure relevant to the given system and the detected errors).

I want to achieve something like this, however I cannot pass the Type retrieved from the specific implementation in the method call.
The services are provided through factory pattern.

Is it even possible what I want to achieve?
What better solutions/patterns are there to meet my requirements?
image.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Next page

Similar Threads

Forwarding T to other generic method
C#CC# / help
3y ago
✅ Specialising a generic method
C#CC# / help
4y ago
Calling a static abstract method without a generic type [Answered]
C#CC# / help
4y ago
How to pass a Type to a method for a return of the same type
C#CC# / help
3y ago