Explain OUT Parameters In detail ?
ans:-
Out parameters are those special parameters in C#, we can use it for create reference parameter so all the changes or modifications can automatically updated in original variable.
out parameters are declared by out keyword. whenever out keyword apply to the parameter then automatically results receive by that parameters
- the parameters are not allow to use in asynchronous methods.
- the out parameters are not allowed to use in iterator methods.
- there can be more than one out parameters in a method.
- method overloading can also be done using out parameters.
- Example
using system;
class GFG;
{
static public void main ()
{
int i ;
addition (out i);
console.written( "the addition of the value i :{0}", i );
}
public static void addition ( out int i )
{
i=30;
i+=i;
}
}
O/P :-
0 comments:
Post a Comment