Skip to main content

Posts

Showing posts from April, 2008

C#: call by reference using "ref"

public void ChangeValue( ref uint cB1 , ref uint c12, ref uint c23){     // change value through reference     cB1 = 10;     cB2 = 20;     cB3 = 30; }   public void MainFunction(){     uint cxxB1, cxxB2, cxxB3;     cxxB1 = 0;     cxxB2 = 0;     cxxB3 = 0;     // pass the reference to the method     ChangeValue( ref cxxB1 , ref cxxB2, ref cxxB3);    // print out the value after change     Console.Out.WriteLine("cxxB1 = " + cxxB1); // 10     Console.Out.WriteLine("cxxB2 = " + cxxB2); // 20     Console.Out.WriteLine("cxxB3 = " + cxxB3); // 30 }