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

Answers were Sorted based on User's Feedback



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

Answer / sreekanth m

Two keywords are "ref" and "out".

the difference between them are: In the case of "ref", the
passed argument should be initialized first whereas
for "out", its not mandatory.

Is This Answer Correct ?    10 Yes 1 No

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

Answer / 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

More C Sharp Interview Questions

What is cache memory in c#?

0 Answers  


What is a callback c#?

0 Answers  


Explain how is the dll hell problem solved in .net?

0 Answers  


is it possible to inherit a class but methods declared in the class should not be inheritable i possible how?

8 Answers   Microsoft,


What is verbatim literal in c#?

0 Answers  






What are the advantages of using assemble language programming?

0 Answers   Ittiam Systems,


Give examples for value types?

0 Answers  


What is instantiating a class in c#?

0 Answers  


Explain partial class in c#?

0 Answers  


Can you create sealed abstract class in c#?

0 Answers  


Is object an int c#?

0 Answers  


What is use of abstract class in c#?

0 Answers  


Categories