Sealed interface #7451
Replies: 4 comments 2 replies
-
I would not see "sealed interface" as can't be implentend in foreign assemblies. For me it looks that it can not be extended by other interface declarations. |
Beta Was this translation helpful? Give feedback.
-
Maybe the interface can specify the types allowed to implement it with attributes in addition to the sealed [ImplementedBy(typeof(something)] |
Beta Was this translation helpful? Give feedback.
-
Existing approaches would be:
You can work around these if you're determined, but the messaging can make it clear that you'll only hurt yourself with that kind of determination. |
Beta Was this translation helpful? Give feedback.
-
public sealed interface IMyInterface
{
}
It is a public interface, that can be used in other assemblies, but not implemented outside of the assembly it is defined in.
Beta Was this translation helpful? Give feedback.
All reactions