To use a ref parameter, both the method definition and the calling method must explicitly use the ref keyword. E.g:

To use a  ref  parameter, both the method definition and the calling method must explicitly use the  ref  keyword. E.g:
class RefExample
{
static void Method(ref int i)
{
i = 44;
}
static void Main()
{
int val = 0;
Method(ref val); // val is now 44
}
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326459266&siteId=291194637