CSharp · Console
using System;
public class Program
{
public static void Main()
{
var myString = "initial value";
MyMethod(myString, MyRefMethod(ref myString));
}
public static string MyRefMethod(ref string str)
{
str = "new value";
return "this variable doesn't really matter for this example";
}
public static void MyMethod (string importantString, string doesntMatterString)
{
Console.WriteLine(importantString);
}
}