Why we use “this” in Extension Methods?

后端 未结 6 1262
遥遥无期
遥遥无期 2021-01-17 10:36

I want to ask why we use \"this\" keyword before the parameter in an extension method (C# Language)........... like this function :

    public static int ToI         


        
6条回答
  •  爱一瞬间的悲伤
    2021-01-17 10:55

    It's just the syntax that was chosen to indicate an extension method. Here's an interesting view point on the extension method syntax differences between C# and vb.net: Extension Method Implementation differences between C# and VB.NET

提交回复
热议问题