Answer Posted / raj093300
ref keyword casues an argument to be passed by reference,not
by value.The effect of passing by reference is that any
change to the parameter in the method is reflected in
undergoing argument variable in the calling argument.The
value of a reference parameter is always the same as the
value of the underlying argument variable...
AS SHOWN IN THIS EXAMPLE...
class sample
{
public static int value(ref int a)
{
a=100;
return a;
}
static void Main()
{
int b=22;
int c=value(ref b);
Console.WriteLine("Output was " +c);
Console.Readkey();
}
}
| Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
What to implement on my class Finalize or IDisposable
What is asp net c# corner?
What are the fundamental principles of oo programming?
How will you deploy the dll file in gac?
Should I use double or float?
Can I define my own exceptions?
What is the signature of a method?
Explain the types of errors in c#?
What is Satellite Assemblies ?
what is the difference between a struct and a class in c#?
Is void a class?
Can we inherit singleton class in c#?
Define constructor in c#.
What is byte c#?
what is partial assembly reference