Introduction
Passing Parameters to a method is explained here.C#.Net supprots to pass the parameters in three ways
1. CallByValue
2. CallByRef
3. CallbyOut
When formal argument is modified, if modifications are reflected on actual arguments,then the concept is called as CallByRef.
When formal arguments are modified, if modifications are not reflected in actual arguments, then the concept is called as CallByValue
By default all the variables will be passed by value.
To pass a variable by reference, ‘Ref’ keyword is used.
Ref keyword must be used along with formal and actual arguments.
The variables passing by ref must be initialized.
CallByOut: Out is a keyword. Out and Ref are almost same. Ref variables must be initialized,but Out variables can be passed without initialization also. Even if Out variable is initialized, the value will not be passed.
Summary:
CBV: Value will be passed.
CBR: Value and Address will be passed
CBO: Only address will be passed.
Comments Post a Comment
mehmet 11/3/2012 (IST) / Reply
I'am dowloand a code for word puzzle
Faiza Khan 3/16/2013 (IST) / Reply
reqiured a puzzle game in c language using graphics