谢谢! ArjenHi,Form a performance perspective, is it wise to use the ref statement as muchas possible?Thanks!Arjen推荐答案无论如何,对象本身都是通过引用传递的,所以我认为 使用ref实际上会减慢一点点(增加一个级别 的间接。 当我需要重置变量时我只使用ref指向另一个 对象。 - 史蒂夫 Arjen< bo ** ***@hotmail.com写信息 新闻:1B ****************************** **** @ microsof t.com ...The objects themselves are passed by reference anyway, so I would think thatusing "ref" would actually slow things down a tiny bit (adds one more levelof indirection.I only use "ref" when I need to reseat the variable to point to a differentobject.- Steve"Arjen" <bo*****@hotmail.comwrote in messagenews:1B**********************************@microsof t.com... 形成绩效视角,是明智的吗?使用ref语句作为 多 尽可能? 谢谢! ArjenHi,Form a performance perspective, is it wise to use the ref statement asmuchas possible?Thanks!Arjen Steve Harclerode< Li ************* @ hot.mail.comwrote:Steve Harclerode <Li*************@hot.mail.comwrote: 对象本身无论如何通过引用传递The objects themselves are passed by reference anyway 不,它们不是。引用通过价值。这有很大的价值。请参阅 http://pobox.com/~skeet/csharp/parameters.html 我只使用ref当我需要重置变量以指向不同的 对象时。I only use "ref" when I need to reseat the variable to point to a differentobject. 完全正确。 - Jon Skeet - < sk *** @ pobox.com> 网站: http:// www。 pobox.com/~skeet 博客: http: //www.msmvps.com/jon_skeet C#深度: http ://csharpindepth.comExactly.--Jon Skeet - <sk***@pobox.com>Web site: http://www.pobox.com/~skeetBlog: http://www.msmvps.com/jon_skeetC# in Depth: http://csharpindepth.com " Jon Skeet [C#MVP]" < sk *** @ pobox.comschreef在bericht 新闻:MP ********************* @ msnews.microsoft.com 。 .."Jon Skeet [C# MVP]" <sk***@pobox.comschreef in berichtnews:MP*********************@msnews.microsoft.com. .. Steve Harclerode< Li ************* @ hot.mail.comwrote:Steve Harclerode <Li*************@hot.mail.comwrote: >无论如何,对象本身都是通过引用传递的。>The objects themselves are passed by reference anyway 不,他们不是。引用按值传递。有一个很大的 差异。请参阅 http://pobox.com/~skeet/csharp /parameters.html >我只使用" ref"当我需要重置变量以指向不同的对象时。>I only use "ref" when I need to reseat the variable to point to adifferentobject. 完全正确。 - Jon Skeet - < sk *** @ pobox.com> 网站: http:// www。 pobox.com/~skeet 博客: http: //www.msmvps.com/jon_skeet C#深度: http ://csharpindepth.com 谢谢!Thank you! 这篇关于使用ref的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-27 17:55