I have a basic category object that has also subcategories in it. This is a simplified version of my object structure:
Category
int Id
string CategoryName
string Path
Category ParentCategory
List<Category> SubCategories
Computer
--> Accessories
--> Keyboard
--> Mouse
--> Storage
--> Flash
--> Micro
How can I write a function that creates a path for all the categories?
By path, I mean:
For Keyboard: Computer/Accessories/Keyboard
For Accessories: Computer/Accessories
For Computer: Computer
Something like this should work: