Banner Ad

Friday, May 16, 2014

Daily interview Question #9: what is the purpose of ref and out parameters in C#?

By Francis   Posted at   9:00 AM   No comments

          Ref keyword is used to send the particular parameter as a reference to the function or subroutine.
          In some cases we may want to return value from the function but we don't want to use that variable within the function. We just get back some value, that's all. In these kind of scenarios we may go with 'out' parameter.
          The main difference between the two is, before passing ref parameter we must initialize the particular variable. But this kind of initialization is not necessary with 'out' parameter.

About Francis

Francis, an Associate at Cognizant. Having 7+ Years of experience in Microsoft web technologies.

0 comments :

Please give your valuable comments to improve the contents

Connect with Us