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 is part of a method signature in c#?
What is asynchronous one-way calls?
How do I calculate relative time?
Is c# static or dynamic?
How to add controls dynamically to the form using c#.net.
What are the applications of c#?
What is thread pooling?
What are examples of desktop applications?
what happens if you inherit multiple interfaces and they have conflicting method names?
What are the 4 pillars of any object oriented programming language?
What is uint64_t?
Explain what are the steps for creating clr trigger?
Which of these string definitions will prevent escaping on backslashes in c#?
What does dbml mean?
What is expression c#?