Can C# extension methods access private variables?

前端 未结 7 999
借酒劲吻你
借酒劲吻你 2021-02-01 11:49

Is it possible to access an object\'s private variables using an extension method?

7条回答
  •  有刺的猬
    2021-02-01 12:24

    An extension method is essentially a static method so all you have access to are the public members of the instance on which the extension method is invoked on

提交回复
热议问题