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
What is difference between array and arraylist in c#?
What is appdomain in c#?
what is object-oriented programming (oop) language?
Can abstract class be instantiated c#?
What is difference between c and c sharp?
What is difference between encapsulation and abstraction in c#?
What is difference between .net and c#?
What is difference between assembly and namespace?
Explain what are three test cases you should go through in unit testing?
What is parseexact c#?
What is meant by collections in c#?
What is value c#?
Why we use get set property in c#?
What are strongly typed objects?
How can we make a thread sleep for infinite period ?