About Ref and out parameters in c#! Introduction : ref : we can pass an argument as a referance with this keyword. If any changes happen in the methos then the value will be reflected in the calling method. The value of the ref variable mustbe initalized befour calling the methos. Static keyword we have to use in the method. Syntex: public static return_type method_name(ref variable_name) { // body of the method } out : The functionality of out key word is also same like ref but here we can pass an argument without initalized the value. Here also static key word have to use. Syntex: public static return_type method_name(out variable_name) { // body of the method } Example : using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace codePractice { class Program { static voi...
This Blog is for study and coding reference purpose.