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.
Friday, May 16, 2014
Home
»
Daily interview Question #9: what is the purpose of ref and out parameters in C#?
Daily interview Question #9: what is the purpose of ref and out parameters in C#?
By
Francis
Posted at
9:00 AM
No comments
About Francis
Francis, an Associate at Cognizant. Having 7+ Years of experience in Microsoft web technologies.
Please give your valuable comments to improve the contents
- Learn By Experience: SMS Gateways
- ASP.Net Forums - FAQ #2 : ASP.Net Project Ideas
- ASP.Net Forums – FAQ #1 : How to enable Adsense in my site?
- Main components of .Net Framework
- ASP.Net Forums–FAQ #6: ASP.Net Session Expired Problem
- How to Send SMS From ASP.Net Web Application?
- Visual Studio Tips & Tricks: 2 – Create Virtual Directory Problem
- Visual Studio Tips & Tricks–10 : How to Change the color theme in Visual Studio 2015?
- CRUD Operation - ASP.Net MVC with ADO.Net
- .Net Architecture
0 comments :