Is it safe for structs to implement interfaces?

前端 未结 9 2113
既然无缘
既然无缘 2020-11-29 16:44

I seem to remember reading something about how it is bad for structs to implement interfaces in CLR via C#, but I can\'t seem to find anything about it. Is it bad? Are the

9条回答
  •  南笙
    南笙 (楼主)
    2020-11-29 17:19

    There are no consequences to a struct implementing an interface. For example the built-in system structs implement interfaces like IComparable and IFormattable.

提交回复
热议问题