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 are some examples of desktop applications?
What is the difference between select and selectmany?
What is difference between property and variable in c#?
Is list immutable in c#?
What does int32 mean in c#?
Can an array be null c#?
What is a type c#?
Explain About namespaces
What is difference between field and property in c#?
Explain how to implement delegates in c#.net
What is Private Constructor? and it’s use? Can you create instance of a class which has Private Constructor?
What is the syntax for calling an overloaded constructor within a constructor?
What are events in C#?
Where static variables are stored?
What is stringreader in c#?