How to pass references as arguments in a method in c#

前端 未结 7 1185
花落未央
花落未央 2021-01-25 00:54

How can you pass refernces in C#?

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-25 01:21

    Your questions isn't clear, but I'd like to point out that in C#, objects are passed by reference by default. Meaning, if you have an object, and then pass that object on to a method that makes changes to that object, those changes will affect the object in your calling code as well, since they both reference the same object.

提交回复
热议问题