I know complex types are passed by Reference in C# and primitive types are passed by Value. Can I pass primitive types by reference in C#?
Update:
Thanks for answers, but my example is?
void test(object x) {
}
long y = 1;
test(ref y);
This throw this exception: The ‘ref’ argument type doesn´t match parameter type
Post-update you can pass boxed values around by reference.
Just keep in mind it’s terrible practice, and risky (due to cast exceptions) to do this.