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
How do I edit a dll file?
How do I declare a pure virtual function in c#?
Can we override static class in c#?
What is ilasm.exe used for?
What is the use of console readkey in c#?
What is the difference between int.parse and int.tryparse methods?
How to move to a state-related codebase?
Differentiate between object pooling and connection pooling in c#?
What does xpath return?
Are arraylist faster or arrays?
Explain about Destructor method?
Which is faster hashtable or dictionary?
What is the difference between readkey and readline in c#?
What is private virtual in C#?
Explain acid rule of thumb for transactions in c#.