Can C# extension methods access private variables?

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

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

7条回答
  •  星月不相逢
    2021-02-01 12:27

    No, unless you give some kind of access to them through public properties or a proxy pattern.

提交回复
热议问题