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

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

How can you pass refernces in C#?

7条回答
  •  别那么骄傲
    2021-01-25 01:29

    You can pass parameters by reference in C# using this syntax.

    public void MyMethod(ref string myString)
    {
    
    }
    

    You will then need to put ref before the value when passing it.

提交回复
热议问题