using System; /* Parameter with "out" modifier cannot be read. Parameter with "out" modifier should be assigned value before leaving the function. Parameter with "ref" modifier should be assigned value before the function call. Numeric/String Literals are not passed to the function with "ref" modifier. To Pass Variable No.of arguments to a function use "params"modifier. */ class ParamDemo { public static void Main() { int TestValue=100; ParamDemo obj=new ParamDemo(); obj.ParamIn(TestValue); Console.WriteLine("Default Mechanism: {0}",TestValue); obj.ParamRef(ref TestValue); Console.WriteLine("ref Argument: {0}",TestValue); TestValue=100; obj.ParamOut(out TestValue); Console.WriteLine("out Argument: {0}",TestValue); obj.ParamParams(1,2,3,4,5); } public void ParamIn(int Value) { Value=200; } public void ParamRef(ref int Value) { Value=200; } public void ParamOut(out int Value) { //Console.WriteLine(Value); //This Causes Error only Writing is Permitted Value=200; // This Should not be omitted.Function should Assign Out Param } public void ParamParams(params int[] Values) { foreach(int val in Values) { Console.WriteLine(val); } } }