Out and ref keywords in c#
what is ref and out keyword in c#
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Khargesh RajputRank #616 · 3.9K reputationPosted Feb 25, 2015, 5:35 AM EST
RakeshRank #520 · 4.7K reputationPosted Feb 25, 2015, 5:41 AM EST
http://www.dotnetperls.com/parameter
Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Feb 25, 2015, 5:41 AM EST
Pankaj Kumar ChoudharyRank #80 · 24.4K reputationPosted Feb 25, 2015, 7:32 AM EST
1. Ref variable must be assigned before it used but out does not require.
2. Our compiler never allocate a memory to Out variable before it is used but in case of Ref the memory is allocated to variable before use.
3. The out parameter 'value' must be assigned to before control leaves the current method but Ref variable does not put any such type restriction.
These are 3 main difference b/w Out and Ref Keyword ...........
Santhakumar MunuswamyRank #128 · 17.3K reputationPosted Feb 25, 2015, 9:23 AM EST
Could you please try msdn link
https://msdn.microsoft.com/en-us/library/14akc2c7.aspx
https://msdn.microsoft.com/en-us/library/t3c3bfhx.aspx
Jignesh TrivediRank #16 · 50.3K reputationPosted Feb 25, 2015, 6:21 PM EST
http://www.c-sharpcorner.com/UploadFile/ff2f08/ref-vs-out-keywords-in-C-Sharp/
hope this will help you.