CSharp · Console
using System;
public class Program
{
public static void Main()
{
var myString = "initial value";
MyRefMethod(ref myString);
MyMethod(myString, 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);
}
}