I have problem with dictionary, i write simple code to explain that, can i achieve output 2 instead of 1?
I cannot use ref (because of TryGetValue)
static void Main(string[] args)
{
object j = 1;
Test(j);
Console.WriteLine(j);
}
static void Test(object one)
{
one = (object)2;
}
In my case i need to update dictionary row with key name with myValue
if (dictionary.TryGetValue(name, out var outObject))
{
outObject = myValue;
}