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 thread safe in c#?
How does it work?
Int map to which .net types?
What is session c#?
What is garbage collector and where should you use in .NET?
in the nunit test framework, which attribute must adorn a test class in order for it to be picked up by the nunit gui?
What do u meant by "SBI" of an object?
What is Custom attribute? How to create? If I'm having custom attribute in an assembly, how to say that name in the code?
What is the predicate of a sentence?
What is the difference between Static, Const and read only?
What is expression tree in c#?
What is the importance of closing an ado.net application?
Define xslt.
how dot net compiled code will become platform independent?
What is super class in c#?