Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the use of attributes on an interface?

Using Resharper, I extracted an interface of an existing class. This class has some attributes set on a few members, and Resharper also put these on the interface members.

Can I delete these attributes from the interface? Attributes on an interface aren't inherited when implementing an interface right?

like image 539
Gerrie Schenck Avatar asked Feb 28 '23 23:02

Gerrie Schenck


1 Answers

They aren't used by the implementing class - but still might be critical. For example, WCF defines service-contracts and operation-contracts by the attributes on the interface.

If they aren't of use in your case, then delete them. Otherwise, leave them alone ;-p

like image 187
Marc Gravell Avatar answered Mar 12 '23 04:03

Marc Gravell