What are the two keywords used to pass a variable by
reference in c#?

Answer Posted / pramod singh

A variable of a reference type does not contain its data
directly; it contains a reference to its data. When you pass
a reference-type parameter by value, it is possible to
change the data pointed to by the reference, such as the
value of a class member. You cannot change the value of the
reference itself; that is, you cannot use the same reference
to allocate memory for a new class and have it persist
outside the block. To do that, pass the parameter using the
ref (or out) keyword. For simplicity, the following examples
use ref.

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I edit a dll file?

544


How do I declare a pure virtual function in c#?

662


Can we override static class in c#?

560


What is ilasm.exe used for?

582


What is the use of console readkey in c#?

572






What is the difference between int.parse and int.tryparse methods?

651


How to move to a state-related codebase?

1013


Differentiate between object pooling and connection pooling in c#?

654


What does xpath return?

631


Are arraylist faster or arrays?

590


Explain about Destructor method?

636


Which is faster hashtable or dictionary?

585


What is the difference between readkey and readline in c#?

537


What is private virtual in C#?

668


Explain acid rule of thumb for transactions in c#.

598