您必须指定
ref并
out明确。您将如何使用 扩展方法 执行此操作?此外,您真的 要 这么做吗?
TestClass x = new TestClass();(ref x).ChangeWithExtensionMethod(otherTestClass);// And now x has changed?
还是
ref只为扩展方法中的第一个参数指定零件?
老实说,这对我来说听起来很奇怪,并且是不可读(或至少难于预测)代码的秘诀。

您必须指定
ref并
out明确。您将如何使用 扩展方法 执行此操作?此外,您真的 要 这么做吗?
TestClass x = new TestClass();(ref x).ChangeWithExtensionMethod(otherTestClass);// And now x has changed?
还是
ref只为扩展方法中的第一个参数指定零件?
老实说,这对我来说听起来很奇怪,并且是不可读(或至少难于预测)代码的秘诀。