int NormalVaribale = 1; int referencevariable = 1; int outvaraibale = 1; Normalmethod(NormalVaribale); referencemethod(ref referencevariable); outmethod(out outvaraibale); Console.WriteLine("Normal Variable"+NormalVaribale); Console.WriteLine("(REF)Reference Variable"+referencevariable); Console.WriteLine("(out) Out Varaible"+outvaraibale);
ref :Value must be Initialized before it is passed to the method. Reference is being passed to the method,so the value changed will get reflected./*It has got Nothing to do with value type and reference type both of these can use ref*/
out:Value need not be Assigned,but has to be defined before the method exists.
Note:Even though you have initialized before passing to method,you got to assign value before the method exists.