Tag Archives: .NET

What is Recursive Programming?

When writing programs, it’s often necessary to perform repeating operations on collections of items such as customer orders or invoices.  Often, you can just iterate through the collection or count the items to determine how many times to perform the operation.  When working with a hierarchy of items such as a directory structure where you have an unknown and varying number of levels under each branch, it’s a different story.  For this, the typical method is to use recursive programming, often just called recursion. This is a method in which one routine is designed to analyze the items on one level of the hierarchy, look for any sublevels and then call itself to analyze each sublevel.  Each time the routine calls itself, it creates another instance of itself that works independently until it’s finished and then returns to the instance that called it.

Continue reading