Is it safe for structs to implement interfaces?

前端 未结 9 2055
既然无缘
既然无缘 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:06

    I think the problem is that it causes boxing because structs are value types so there is a slight performance penalty.

    This link suggests there might be other issues with it...

    http://blogs.msdn.com/abhinaba/archive/2005/10/05/477238.aspx

提交回复
热议问题