Introduction:
Here I will explain difference between ref and out parameters in c#.net with example. Both ref and out parameters are used to pass arguments within a method. These ref and out parameters are useful whenever your method wants to return more than one value. Regarding ref parameter you need to initialize it before passing to the method and out parameter you don’t need to initialize before passing to function.
Description:
In
previous posts I explained difference between wcf and web
application,
interview questions in asp.net, sql
server, c#,
Difference between functions and stored
procedures in SQL Server, difference between len and datalength
in sql server
and many articles relating to interview questions. Now I will explain difference between
ref and out parameters in c#.net with example.