What is the Difference between ref and out keyword?
will you brief describe about ref and out keywords
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Lakshmanan Sethu SankaranarayanPosted May 1, 2014, 3:53 AM
Pawan KumarPosted May 1, 2014, 3:11 AM
In C Sharp, Parameters are passed by value to a method by default. If we want to pass them by reference then we can use either "out" or "ref" keyword.
Output parameters: In this the variable specified at the time of calling does not need to have a assigned value. When method is invoked completely, we can read that variable.
Reference Parameter: In this, we don't pass the value of the parameter instead we pass the address of the variable. No new storage is created for this. it manipulate the same storage address Reference parameters require ref modifier as part of both the declaration and the calling.
best of luck !!!!