REF: - In the ref parameter, we pass the parameter by using ‘ref’ keyword. When we pass any ref parameter then we have to assign value in that variable those we have to pass. Without assigning we cannot pass the parameter.
Syntax: - method name(ref value type variable name);
OUT: - In the out parameter, we pass the parameter by using ‘out’ keyword. When we pass any out parameter then we don’t have assign value in that variable those we have to pass.
Syntax: - method name(out value type variable name);
Example: -"OUT"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BreakAndContinue
{
class Program
{
public static void Add(out int a)
{
a = 50;
Console.WriteLine(a);
}
Om ji mishra
23-Oct-2019REF: - In the ref parameter, we pass the parameter by using ‘ref’ keyword. When we pass any ref parameter then we have to assign value in that variable those we have to pass. Without assigning we cannot pass the parameter.
Syntax: - method name(ref value type variable name);
OUT: - In the out parameter, we pass the parameter by using ‘out’ keyword. When we pass any out parameter then we don’t have assign value in that variable those we have to pass.
Syntax: - method name(out value type variable name);
Example: -"OUT"
Example: -"ref"