Extension methods overridden by class gives no warning

前端 未结 3 1028
别那么骄傲
别那么骄傲 2021-02-02 12:41

I had a discussion in another thread, and found out that class methods takes precedence over extension methods with the same name and parameters. This is good as extension metho

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-02 13:15

    One possible way to reduce the chance of this happening is to include the abbreviation Ext at the end of the extension method name. I know, this is very ugly, but it reduces the chances of this happening.

    MyMethod_Ext
    

    or

    MyMethodExt
    

提交回复
热议问题