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

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

How can you pass refernces in C#?

7条回答
  •  天命终不由人
    2021-01-25 01:13

    Calling Code:

    string companyName = "New Company";
    GetEmail(ref companyName);
    

    Method Code:

    private void GetEmail(ref string companyName)
    {
    
    }
    

提交回复
热议问题