© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Search
Star
Feedback
Setup for Free
C
C#
•
2y ago
•
21 replies
TahaA
✅ where constraint on interface method
Is it even possible
? Like
public void RefuelCar<c>(c Car) where c : IUseGas.Refuel
public void RefuelCar<c>(c Car) where c : IUseGas.Refuel
Here the generic type is constrainted to where it implements an interface
's method
, whereas the name of the interface is
IUseGas
IUseGas
C#
Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Recent Announcements
Similar Threads
Was this page helpful?
Yes
No
Similar Threads
✅ Can i put constraint on ctor in interface
C
C# / help
3y ago
Can't access interface method
C
C# / help
2y ago
interface vs extension method vs method in class
C
C# / help
3y ago
❔ Static interface methods
C
C# / help
3y ago