I've got a folder structure represented as a parent / child relation tree. Now let's imagine the following tree:
-- Folder1
--- Subfolder1-1
---- Subfolder1-1-1
--- Subfolder2
---- Subfolder2-1
-- Folder2
Now I obviously got navigation properties to use, so when inside Subfolder1-1 I got a property ParentFolder that represents Folder1.
How can I now walk up the tree to generate a concatenated string out of the folder names?
For example when calling this method from Subfolder1-1-1, I want the string to be Folder1.Subfolder1-1.Subfolder1-1-1 and when calling from Subfolder2-1, I want the string to be Folder1.Subfolder2.Subfolder2-1.
I've thought about recursion, but the following did not work:
public string GetCompleteFolderName(string delimiter)
{
    string folderName = null;
    if (FolderParent != null)
    {
        folderName += GetCompleteFolderName(FolderParent) + delimiter;
    }
    return folderName;
}
private string GetCompleteFolderName(Folder folder)
{
    string folderName = null;
    if (folder != null)
    {
        folderName = folder.Name;
    }
    return folderName;
}
				
                        
Think this should do the trick
outputs: f1.f2.f3