Reference Type passed by Value
#1
#2
Reference Type passed by Reference (ref keyword)
#1
#2
If Both Reference Type & Value Type passed by Value
If Both Reference Type & Value Type passed by Value, but new an instance
If Reference Type passed by Reference
If Value Type passed by Reference
If Value Type passed by Reference using ref keyword
If Value Type passed by Reference using out keyword
If Value Type passed by Reference using ref keyword, but no initial value assignment of variable
Compile error: Use of unassigned local variable xxx
ref & out keyword has following difference
1. ref must have initial value assignment before passing to method, if not we will see the error
2. out must change its value within the method implementation, if not we will see the error
Blog to read:
http://rapidapplicationdevelopment.blogspot.tw/2007/01/parameter-passing-in-c.html
http://www.dotblogs.com.tw/hunterpo/archive/2010/05/02/14978.aspx (in Chinese)
沒有留言:
張貼留言