|
difference between ref and out C#
|
|
12-05-2009, 05:53 PM
Post: #1
|
|||
|
|||
|
difference between ref and out C#
When passing a variable by ref you must have the variable initialized first. Example:
int num = 0; setNum(ref num); When passing a variable by out you do not have to have the variable initialized. Example: int num; setNum(out num); In conclusion they both pass a variable by reference. If you are going to use the ref keyword initialize it or you will get a error! else just use out
|
|||
|
12-05-2009, 08:49 PM
Post: #2
|
|||
|
|||
|
RE: difference between ref and out C#
Yeah i knew about this. Very good !
There's a fine line between genius and insanity. I have erased this line. Oscar Levant There's a fine line between an administrator and black hat hacker. I have erased this line. Dr DEBCOL |
|||
|
« Next Oldest | Next Newest »
|





