I started playing with small idea about how to go through document repository on SharePoint using more universal approach than just piling code to using-blocks and methods that depend on these. My goal was to separate in code hierarchy traversing logic from document exporting logic so I can use traversing part also in other projects on different types of hirarchies. Here is my nice and clean solution.
One of new language features of C# 8.0 is support for using declarations. These declarations enable shorter syntax for declaring disposable variables we want to dispose. Also using declarations give us a little bit cleaner code while compiler makes a dirty work of producing correct code that takes care of disposing disposable variables.
C# doesn’t have built-in function to repeat a string. There are different version for string.Repeat() available in internet and it’s up to reader to find out which version works better. Here is the list of most popular implementations I found across the web. I list my findings here with the results of simple performance test.