what is reference parameter?
what is out parameters?
what is difference these two?

Answer Posted / lakshmi

When we pass a parameter as ref to a method, the method
refers to the same variable and changes made will affect
the actual variable. even the variable passed as out
parameter is same as ref parameter, but implementation in
c# is different,
Arguement passed as ref parameter must be initialized
before it is passed to the method. But in case of out
parameter it is not necessary. But after a call to a method
as out parameter it is necessary to initialize.
When to use out and ref parameter, out parameter is used
when we want to return more than one value from a method.

Is This Answer Correct ?    27 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I format a string in c#?

478


Do while loops yes or no c#?

524


What is main thread in c#?

501


Write one code example for compile time binding and one for run time binding? What is early/late binding?

597


What are the steps for creating clr trigger

565






What is static noise?

503


Define multicast c# delegate?

558


Is null in c#?

483


Explain manifest & metadata in c#.

533


windows c# using datagridview in edit form sql server

3569


Explain metadata in c#.

493


What is difference between ienumerable and list?

512


What is IL / CIL / MSIL?

661


What is access specifier in c#?

565


Why are mutable structs evil?

540