
本站地址:http://www.bajiao123.com

[FxCop.设计规则]6. 避免使用输出参数
TypeName:
AvoidOutParameters
CheckId:
CA1021
Category:
Microsoft.Design
Message Level:
Warning
Certainty:
50%
Breaking Change:
Breaking
Cause: A public or protected method in a public type has an out parameter.
Passing types by reference (using out or ref) requires experience with pointers, understanding how value types and reference types differ, and handling methods with multiple return values. Also, the difference between out and ref parameters is not widely understood.
When a reference type is passed "by reference," the method intends to use the parameter to return a different instance of the object. (Passing a reference type by reference is also known as using a double pointer, pointer to a pointer, or double indirection.) Using the default calling convention, which is pass "by value," a parameter that takes a reference type already receives a pointer to the object. The pointer (not the object to which it points) is passed by value, meaning that the method cannot change the pointer to have it point to a new instance of the reference type, but can alter the contents of the object to which it points. For most applications this is sufficient and yields the desired behavior.
If
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>
本站地址:http://www.bajiao123.com

