When to pass ref keyword in

后端 未结 6 933
野性不改
野性不改 2020-12-06 11:45

I\'ve read the difference between passng and not passing ref in parameters, however, when would I want to use them?

For example, I had some logic in a method which c

6条回答
  •  一个人的身影
    2020-12-06 12:24

    The effect is that any changes to the parameter in the method will be reflected in that variable when control passes back to the calling method. So if you want the value assigned to the parameter to survive past the method call it's a possible usecase

提交回复
热议问题