Answers for "access a local varible in a different function C#"

C#
1

access a local varible in a different function C#

The closest thing that somehow relates to your question that I can think of are ref-Parameters in method calls:

void SomeMethod()
{
    int x = 1;
    SomeOtherMethod(ref x);
    // at this point x==2
}

void SomeOtherMethod(ref int a)
{
    a = 2;
}
Posted by: Guest on June-09-2021

C# Answers by Framework

Browse Popular Code Answers by Language