Ref modifier can use data value change in another function.
class Program
{
static void Main(string[] args)
{
int number = 20;
int number1 = 20;
AddFive(ref number);
AddFive1(number1);
Console.WriteLine(number);
Ref modifier can use data value change in another function.
class Program
{
static void Main(string[] args)
{
int number = 20;
int number1 = 20;
AddFive(ref number);
AddFive1(number1);
Console.WriteLine(number);
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.
Console.WriteLine(number1);
Console.ReadKey();
}
static void AddFive(ref int number)
{
number = number + 5;
}
static void AddFive1(int number)
{
number = number + 5;
}
}
This simple c# program pass Two function value is same but one function use ref
keyword and other function do not use ref key word, two function include
operations are same but the operation affected only ref keyword function
SubashPosted Sep 7, 2016, 3:22 AM
Can u explain in detail