Posts

Showing posts with the label #C# #Ref #Out

C# Ref and Out Keywords

Ref - Ref is two ways from caller to callee and back.  static void Main(string[] args)         {             int outSideVar = 10;             GetNextNameByOut(out outSideVar);              Console.WriteLine(outSideVar);         }         static void GetNextNameByOut(out int inSideVar)         {             inSideVar = inSideVar + 20;         }  Out - Data sent from the caller has been discarded and its mandatory to initialize the variables inside the callee.  Out is a ne way from callee to caller.  static void Main(string[] args)      ...