c# - When to pass ref keyword in -
I've read the difference between passing and did not let the criteria go into the referee, nevertheless, when would I want to use them?
For example, I had some argument in a method that can be re-implemented in my own method, Razor 4.5 made any one of the parameters, but I do not think if If I'm refactoring manually, then I have to do this.
Obviously I do not understand anything. What could possibly happen when in the memory of the red keyword, coding would help in some sort or some scenario?
Thanks
Let me break it down in two questions:
1) When using any method, should use formal parameter declarations at any time?
Use the referee
instead of being able to read and write a variable passed by the caller / 2) Why does a "extraction method" refactoring produce a ref parameter?I do not know the details of the ribs, but I can think of the following negative non-negative value types:
struct S {Private int x; Public int X () {return.x; } Public Zero M () {this.x + = 1; }}
You have one method:
zero fu () {ss = new s (); Fred (s); Blah (s); Bars); S.m (); Console.WriteLine (s.X ()); // print1}
and you do "remove method" on the middle bit:
zero new mode (ref Ss) {Blah (s) ); Bars); S.m (); } Zero Fu () {SS = new S (); Fred (s); Pneumath (referee); Console.WriteLine (s.X ()); // still prints 1}
Instead you make a method without "Ref", then the copy of Call to Naymath (Calls) will be passed in Newmath. Remember, the price types are copied from the price; This is the reason that we call them "price type", it will be a copy that is mutated, and then returns s.X () zero returns. It is a bad idea for a restructuring to implement meaning change in a program, and it is difficult to know whether a given method depends on the variability of the price type or not for a refactor engine.
This is just one more reason why you should avoid volatile price types.
Comments
Post a Comment