![]() |
|
Coding help - Printable Version +- LCKB (https://lckb.dev/forum) +-- Forum: ** OLD LCKB DATABASE ** (https://lckb.dev/forum/forumdisplay.php?fid=109) +--- Forum: Programmers Gateway (https://lckb.dev/forum/forumdisplay.php?fid=196) +---- Forum: Coders Talk (https://lckb.dev/forum/forumdisplay.php?fid=192) +---- Thread: Coding help (/showthread.php?tid=839) |
- pwesty - 05-26-2012 no - Wizatek - 05-26-2012 U can only use return once, so u have to write another function returning the other table - someone - 05-26-2012 Or you can return by reference: public void swap(ref int a, ref int b) { int c = a; a = b; b = c; } //... int a = 0, b = 1; swap(ref a,ref b); //... Since in C# every Type is inherited from the base object class you could just return an array of objects: public object[] Swap(int a, int b) { return new object[] { b, a }; } //... int a = 0, b = 1; object[] data = Swap(a, b); a = (int)data[0]; b = (int)data[1]; //... - Polo - 05-10-2013 -.- - DrWho - 05-21-2013 -.- Nice thread necro. |