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

What is eager and lazy loading in c#?

463


How are Windows programs different from normal C-programs?

1658


Explain how to implement an object pool in c#.net

517


What can be done with c#?

435


What are the different types of classes?

472






What is the purpose of dictionary in c#?

453


What is difference between field and property in c#?

442


What is deadly diamond problem?

540


Is a decimal an integer?

473


What is msil, and why should developers need an appreciation of it if at all?

565


Can we inherit static class in c#?

476


What is the difference between namespace and class in c#?

496


What's c# ?

588


Is c# good for games?

473


What is dependency injection in simple words?

497