O'Reilly logo

C# Primer Plus by Klaus Michelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Pending Method Instances of Different Methods

To understand how recursion works, it is important to first understand the mechanics of chains of method calls. Listing 23.1 does not contain any recursive method calls and does not solve any particular problem, it merely demonstrates what happens when one method calls a second method that calls a third method that calls a fourth method.

Listing 23.1. MethodCallDemo.cs
 01: using System; 02: 03: class MethodCallDemo 04: { 05: public static void Main() 06: { 07: MethodA(3); 08: } 09: 10: public static void MethodA(int level) 11: { 12: Console.WriteLine("First part of MethodA. Level: { 0} ", level); 13: MethodB(level - 1); 14: Console.WriteLine("Last part of MethodA. Level: { 0} ", level); 15: return; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required