Can C# extension methods access private variables?

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

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

7条回答
  •  盖世英雄少女心
    2021-02-01 12:37

    If you own the class that you are extending, you an always declare the class partial, then extend the class & have access to all the private members in a different file... But you wouldn't really be using extension methods.

提交回复
热议问题