© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
5 replies
delferns2001

❔ Creating a hierarchy algorithm

I have an image model, which consists of
public Guid Id { get; set; }
public string Name { get; set; }
public List<string> VirtualDir { get; set; }


virtual dir is the directory the image is stored in, split into a list of strings
so one example: ["folder1","folder1child", "image"]

Now, if i want to create a Hierarchy of the whole directory showing all images in the different folders represented as JSON, something like the below.


{
text: 'Folder 1',
children: [{ name: 'image 1' }, { name: 'image 2' }, { name: 'image 2' }],
},
{
text: 'Folder 2',
children: [
{ name: 'folder 2 child folder', children: [{ name: 'image 1' }] },
{ name: 'image 2' },
{ name: 'image 2' },
],
},



How can i successfully archive this?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Creating an algorithm to solve Number Match
C#CC# / help
5mo ago
A* pathfinding algorithm help
C#CC# / help
9mo ago
Blazor Project Hierarchy
C#CC# / help
2y ago