I made a method that have one parameter and iside it there is one member when i call this method in the main() and path a parameter to it with the ref keyword i recive error massage "argument 1 may not be passed with ref keword "
i tried to remove the ref keyworf it works well
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace learncsharp
{
class Program
{
static int Value(int x)
{
x = 100;
return x;
}
public static void Main()
{
int z = 10;
Value(ref z);
Console.Read();
}
}
}
i am expecting to get the sam result as to get 10