ref c# code example
Example 1: c# pass arg by reference
void Method(ref int refArgument)
{
refArgument = refArgument + 44;
}
int number = 1;
Method(ref number);
Console.WriteLine(number);
Example 2: c# ref
void Method(ref int refArgument)
{
refArgument = refArgument + 44;
}
int number = 1;
Method(ref number);
Console.WriteLine(number);
Example 3: a ref
<a href="https://www.w3schools.com">Visit W3Schools</a>
Example 4: cannot initialize a by-value variable with a reference
ref int x = ref SomeClass.variable;
Example 5: ref in f#
let a = ref 5
let b = a
b := 10
let mutable a = 5
let mutable b = a
b <- 10