What is the difference between ref & out parameters?

Answers were Sorted based on User's Feedback



What is the difference between ref & out parameters?..

Answer / padam

An argument passed as ref must be initialized before passing
to the method whereas out parameter needs not to be
initialized before passing to a method.

Is This Answer Correct ?    8 Yes 0 No

What is the difference between ref & out parameters?..

Answer / satya

ref keyword is used while passing the parameters by reference.
out keyword is used while passing the parameters by out

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More C Sharp Interview Questions

what are nullable types in c#

0 Answers   Cognizant,


Can you declare struct members as protected?

0 Answers  


How do I create multifile assembly?

0 Answers  


Consider the following pieces of C# code: a. interface I1 {/*......*/} interface I2 {/*......*/} struct Point : I1,I2 {/* ..... */} b. struct Book{ int bookId; struct Book b; } c. using M=Mystruct; struct MyStruct{ int id; } class MyClass{ static void Main(string[] args){ M m = new M(); } } d. struct Sample{ Sample ref x; } Which of the above are correct? Choose one of the options below. a, c and d are right a only right a and c are right d only wrong None of the listed options

3 Answers  


What is integer c#?

0 Answers  


Types of Unboxing?

2 Answers   Educomp,


What is the C# syntax to catch any possible exception?

0 Answers   Siebel,


Is null == null c#?

0 Answers  


Explain the three test cases in unit testing?

0 Answers   Siebel,


if we are updating a database using thread, and mean while application crashes or thread being aborted then what will happen in Database? Rollback or Database will be updated? Please explain with different scenario.

0 Answers  


Can main method be final?

0 Answers  


What is difference between dictionary and hashtable?

0 Answers  


Categories