Search code examples
c#stringprivateprotectedvoid

C# Get String from Private void


i need to get a string from a private void in this code in need the teamsite string

protected override void test
    teamsitefinal = teamsite
}

from this code

private void test2 {
   string teamsite = "test"
}

i can't change the private void or protected override void


Solution

  • Assign the string into a private field of the class.

    class MyClass : SomeBaseClass
    {
       string teamsite;
       protected override void test ()
       {
          string teamsitefinal = teamsite;
       }
       private void test2 ()
       {
          teamsite = "test";
       }
    }