public class Test { public static void Main() { // ...Some code... System.Console.WriteLine("Before"); new MyClass().DoSomething(); // ...Some other code... System.Console.WriteLine("After"); } } public class MyClass { private int _myVar; public void DoSomething() { // ...Do something... _myVar = 1; System.Console.WriteLine("Inside"); } }