CSharp · Console
using System;
public class SomeThing
{
public string SomeValue { get; set; }
}
public class Program
{
public static void Main()
{
var oldValueThing = new SomeThing()
{
SomeValue = "Old Value"
};
MyMethod(oldValueThing, MyRefMethod(ref oldValueThing));
}
public static SomeThing MyRefMethod(ref SomeThing str)
{
str.SomeValue = "new Value";
return null;
}
public static void MyMethod (SomeThing originalThing, SomeThing doesntMatterThing)
{
Console.WriteLine(originalThing.SomeValue);
}
}